nfc_device_new(): replace err() by return

Not a good idea to call exit() from a library...
This commit is contained in:
Philippe Teuwen 2013-03-05 19:57:36 +01:00
parent bece73faaf
commit 09ef2e3927
7 changed files with 37 additions and 1 deletions

View file

@ -360,6 +360,10 @@ pn53x_usb_open(const nfc_context *context, const nfc_connstring connstring)
data.model = pn53x_usb_get_device_model(dev->descriptor.idVendor, dev->descriptor.idProduct);
// Allocate memory for the device info and specification, fill it and return the info
pnd = nfc_device_new(context, connstring);
if (!pnd) {
perror("malloc");
goto error;
}
pn53x_usb_get_usb_device_name(dev, data.pudh, pnd->name, sizeof(pnd->name));
pnd->driver_data = malloc(sizeof(struct pn53x_usb_data));