Changeset 677
- Timestamp:
- 05/29/05 16:30:32 (7 years ago)
- Location:
- trunk/src/ifd
- Files:
-
- 17 edited
-
conf.c (modified) (1 diff)
-
device.c (modified) (1 diff)
-
driver.c (modified) (3 diffs)
-
ifd-cardman.c (modified) (1 diff)
-
ifd-ccid.c (modified) (2 diffs)
-
ifd-cm4000.c (modified) (1 diff)
-
ifd-gempc.c (modified) (1 diff)
-
ifd-kaan.c (modified) (2 diffs)
-
locks.c (modified) (1 diff)
-
protocol.c (modified) (2 diffs)
-
ria-server.c (modified) (1 diff)
-
ria.c (modified) (1 diff)
-
sys-bsd.c (modified) (1 diff)
-
sys-linux.c (modified) (1 diff)
-
sys-solaris.c (modified) (4 diffs)
-
sys-sunray.c (modified) (1 diff)
-
usb-descriptors.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ifd/conf.c
r656 r677 201 201 202 202 node = (ifd_conf_node_t *) calloc(1, sizeof(*node)); 203 if (!node) { 204 ct_error("out of memory"); 205 return NULL; 206 } 203 207 node->name = strdup(name); 204 208 -
trunk/src/ifd/device.c
r657 r677 46 46 47 47 dev = (ifd_device_t *) calloc(1, size); 48 if (!dev) { 49 ct_error("out of memory"); 50 return NULL; 51 } 48 52 dev->name = strdup(name); 49 53 dev->ops = ops; -
trunk/src/ifd/driver.c
r657 r677 36 36 37 37 ip = (struct ifd_driver_info *)calloc(1, sizeof(*ip)); 38 if (!ip) { 39 ct_error("out of memory"); 40 return NULL; 41 } 38 42 ip->driver.name = strdup(name); 39 43 ip->next = list; … … 55 59 } 56 60 57 voidifd_driver_add_id(const char *id, const char *name)61 int ifd_driver_add_id(const char *id, const char *name) 58 62 { 59 63 struct ifd_driver_info *ip; … … 61 65 ifd_debug(3, "ifd_driver_add_id(%s, %s)", id, name); 62 66 ip = find_by_name(name, 1); 67 if (!ip) 68 return -1; 69 63 70 ip->id = (ifd_devid_t *) realloc(ip->id, 64 71 (ip->nids + 1) * sizeof(ifd_devid_t)); 72 if (!ip->id) { 73 ct_error("out of memory"); 74 return IFD_ERROR_NO_MEMORY; 75 } 65 76 if (ifd_device_id_parse(id, &ip->id[ip->nids]) >= 0) 66 77 ip->nids++; -
trunk/src/ifd/ifd-cardman.c
r658 r677 59 59 } 60 60 priv = (cm_priv_t *) calloc(1, sizeof(cm_priv_t)); 61 if (!priv) { 62 ct_error("out of memory"); 63 return IFD_ERROR_NO_MEMORY; 64 } 61 65 62 66 reader->driver_data = priv; -
trunk/src/ifd/ifd-ccid.c
r622 r677 559 559 } 560 560 561 if ((st = (ccid_status_t *) calloc(1, sizeof(*st))) == NULL) 561 if ((st = (ccid_status_t *) calloc(1, sizeof(*st))) == NULL) { 562 ct_error("out of memory"); 562 563 return IFD_ERROR_NO_MEMORY; 564 } 563 565 564 566 st->usb_interface=intf->bInterfaceNumber; … … 978 980 } 979 981 980 apdu=(unsigned char *) malloc(len); 981 if (!apdu) 982 apdu=(unsigned char *) calloc(1,len); 983 if (!apdu) { 984 ct_error("out of memory"); 982 985 return IFD_ERROR_NO_MEMORY; 986 } 983 987 memcpy(apdu, buffer, len); 984 988 st->sbuf[dad]=apdu; -
trunk/src/ifd/ifd-cm4000.c
r671 r677 46 46 47 47 priv = (cm_priv_t *) calloc(1, sizeof(cm_priv_t)); 48 if (!priv) { 49 ct_error("out of memory"); 50 return IFD_ERROR_NO_MEMORY; 51 } 48 52 49 53 reader->driver_data = priv; -
trunk/src/ifd/ifd-gempc.c
r667 r677 72 72 73 73 st = (gpc_status_t *) calloc(1, sizeof(*st)); 74 if (!st) { 75 ct_error("out of memory"); 76 return IFD_ERROR_NO_MEMORY; 77 } 74 78 reader->driver_data = st; 75 79 -
trunk/src/ifd/ifd-kaan.c
r667 r677 87 87 88 88 reader->device = dev; 89 if ((st = (kaan_status_t *) calloc(1, sizeof(*st))) == NULL) 89 if ((st = (kaan_status_t *) calloc(1, sizeof(*st))) == NULL) { 90 ct_error("out of memory"); 90 91 return IFD_ERROR_NO_MEMORY; 92 } 91 93 st->reader_type = TYPE_KAAN; 92 94 st->icc_proto[0] = -1; … … 170 172 171 173 reader->device = dev; 172 if ((st = (kaan_status_t *) calloc(1, sizeof(*st))) == NULL) 174 if ((st = (kaan_status_t *) calloc(1, sizeof(*st))) == NULL) { 175 ct_error("out of memory"); 173 176 return IFD_ERROR_NO_MEMORY; 177 } 174 178 st->reader_type = TYPE_B1; 175 179 st->icc_proto[0] = -1; -
trunk/src/ifd/locks.c
r664 r677 43 43 /* No conflict - grant lock and record this fact */ 44 44 l = (ct_lock_t *) calloc(1, sizeof(*l)); 45 if (!l) { 46 ct_error("out of memory"); 47 return IFD_ERROR_NO_MEMORY; 48 } 45 49 l->exclusive = (type == IFD_LOCK_EXCLUSIVE); 46 50 l->uid = sock->client_uid; -
trunk/src/ifd/protocol.c
r663 r677 19 19 * Register a protocol 20 20 */ 21 voidifd_protocol_register(struct ifd_protocol_ops *ops)21 int ifd_protocol_register(struct ifd_protocol_ops *ops) 22 22 { 23 23 struct ifd_protocol_info *info, **ptr; 24 24 25 25 info = (struct ifd_protocol_info *)calloc(1, sizeof(*info)); 26 if (!info) { 27 ct_error("out of memory"); 28 return IFD_ERROR_NO_MEMORY; 29 } 26 30 info->ops = ops; 27 31 28 32 for (ptr = &list; *ptr; ptr = &(*ptr)->next) ; 29 33 *ptr = info; 34 return 0; 30 35 } 31 36 … … 199 204 200 205 p = (ifd_protocol_t *) calloc(1, ops->size); 206 if (!p) { 207 ct_error("out of memory"); 208 return p; 209 } 201 210 p->reader = reader; 202 211 p->ops = ops; -
trunk/src/ifd/ria-server.c
r662 r677 260 260 261 261 clnt = (ria_peer_t *) calloc(1, sizeof(ria_peer_t)); 262 if (!clnt) { 263 ct_error("out of memory"); 264 return NULL; 265 } 262 266 clnt->sock = sock; 263 267 ria_svc_link(clnt); -
trunk/src/ifd/ria.c
r662 r677 38 38 39 39 clnt = (ria_client_t *) calloc(1, sizeof(*clnt) + RIA_QUEUE_LEN); 40 if (!clnt) { 41 ct_error("out of memory"); 42 return NULL; 43 } 40 44 ct_buf_init(&clnt->data, (clnt + 1), RIA_QUEUE_LEN); 41 45 -
trunk/src/ifd/sys-bsd.c
r661 r677 160 160 161 161 if (!(cap = (ifd_usb_capture_t *) calloc(1, sizeof(*cap) + maxpacket))) { 162 ct_ debug("ifd_sysdep_usb_begin_capture: calloc failed");163 return -1;162 ct_error("out of memory"); 163 return IFD_ERROR_NO_MEMORY; 164 164 } 165 165 cap->type = type; -
trunk/src/ifd/sys-linux.c
r661 r677 199 199 200 200 cap = (ifd_usb_capture_t *) calloc(1, sizeof(*cap) + maxpacket); 201 if (!cap) { 202 ct_error("out of memory"); 203 return IFD_ERROR_NO_MEMORY; 204 } 201 205 202 206 cap->type = type; -
trunk/src/ifd/sys-solaris.c
r661 r677 85 85 char *devstat; 86 86 87 if ((devstat = malloc(strlen(name) + 2)) == NULL) { 88 ct_error("devstat malloc failed"); 89 return -1; 90 } 91 memset(devstat, 0, strlen(name) + 2); 87 if ((devstat = calloc(1,strlen(name) + 2)) == NULL) { 88 ct_error("out of memory"); 89 return IFD_ERROR_NO_MEMORY; 90 } 92 91 strcpy(devstat, name); 93 92 strcpy(devstat + strlen(name) - 6, "devstat"); … … 118 117 char *cntrl0stat; 119 118 120 if ((cntrl0stat = malloc(strlen(name) + 5)) == NULL) {121 ct_error(" cntrl0stat malloc failed");119 if ((cntrl0stat = calloc(1, strlen(name) + 5)) == NULL) { 120 ct_error("out of memory"); 122 121 return -1; 123 122 } 124 memset(cntrl0stat, 0, strlen(name) + 5);125 123 strcpy(cntrl0stat, name); 126 124 strcat(cntrl0stat, "stat"); … … 306 304 bytes_to_process = USB_REQUEST_SIZE + 307 305 ((requesttype & USB_EP_DIR_MASK) == USB_EP_DIR_OUT ? len : 0); 308 if ((usb_control_req = malloc(bytes_to_process)) == NULL) { 309 ct_error("usb_control_req malloc failed"); 310 return -1; 311 } 312 memset(usb_control_req, 0, bytes_to_process); 313 if ((recv_data = malloc(len)) == NULL) { 314 ct_error("recv_data malloc failed"); 306 if ((usb_control_req = calloc(1,bytes_to_process)) == NULL) { 307 ct_error("out of memory"); 308 return -1; 309 } 310 if ((recv_data = calloc(1,len)) == NULL) { 311 ct_error("out of memory"); 315 312 free(usb_control_req); 316 313 return -1; … … 464 461 465 462 if (!(cap = (ifd_usb_capture_t *) calloc(1, sizeof(*cap) + maxpacket))) { 466 ct_ debug("ifd_sysdep_usb_begin_capture: cannot calloc");463 ct_error("out of memory"); 467 464 return -1; 468 465 } -
trunk/src/ifd/sys-sunray.c
r661 r677 115 115 116 116 if (!(cap = (ifd_usb_capture_t *) calloc(1, sizeof(*cap) + maxpacket))) { 117 ct_ debug("ifd_sysdep_usb_begin_capture: calloc failed");118 return -1;117 ct_error("out of memory"); 118 return IFD_ERROR_NO_MEMORY; 119 119 } 120 120 cap->type = type; -
trunk/src/ifd/usb-descriptors.c
r660 r677 92 92 endpoint->extra = (unsigned char *)malloc(len); 93 93 if (!endpoint->extra) { 94 ct_debug 95 ("couldn't allocate memory for endpoint extra descriptors"); 94 ct_error("out of memory"); 96 95 endpoint->extralen = 0; 97 96 return parsed; … … 121 120 ); 122 121 if (!interface->altsetting) { 123 ct_ debug("couldn't malloc interface->altsetting");122 ct_error("out of memory"); 124 123 return -1; 125 124 } … … 176 175 ifp->extra = (unsigned char *)malloc(len); 177 176 if (!ifp->extra) { 178 ct_debug 179 ("couldn't allocate memory for interface extra descriptors"); 177 ct_error("out of memory"); 180 178 ifp->extralen = 0; 181 179 return -1;
Note: See TracChangeset
for help on using the changeset viewer.
