pn53x_data_new() now returns null ptr upon malloc() error

This commit is contained in:
Philippe Teuwen 2013-03-18 00:20:49 +01:00
parent af57df532b
commit 06d5b54308
8 changed files with 55 additions and 12 deletions

View file

@ -337,7 +337,10 @@ pn53x_usb_open(const nfc_context *context, const nfc_connstring connstring)
*DRIVER_DATA(pnd) = data;
// Alloc and init chip's data
pn53x_data_new(pnd, &pn53x_usb_io);
if (pn53x_data_new(pnd, &pn53x_usb_io) == NULL) {
perror("malloc");
goto error;
}
switch (DRIVER_DATA(pnd)->model) {
// empirical tuning