Fix mem leak

This commit is contained in:
Philippe Teuwen 2017-05-18 10:40:46 +02:00
parent 00700bc66d
commit 14f48d0122
2 changed files with 2 additions and 2 deletions

View file

@ -311,7 +311,7 @@ typedef enum {
NMT_ISO14443B2SR, // ISO14443-2B ST SRx NMT_ISO14443B2SR, // ISO14443-2B ST SRx
NMT_ISO14443B2CT, // ISO14443-2B ASK CTx NMT_ISO14443B2CT, // ISO14443-2B ASK CTx
NMT_FELICA, NMT_FELICA,
NMT_DEP, NMT_DEP, // DEP should be kept last one as it's used as end-of-enum
} nfc_modulation_type; } nfc_modulation_type;
/** /**

View file

@ -85,7 +85,7 @@ pn53x_init(struct nfc_device *pnd)
} }
if (!CHIP_DATA(pnd)->supported_modulation_as_initiator) { if (!CHIP_DATA(pnd)->supported_modulation_as_initiator) {
CHIP_DATA(pnd)->supported_modulation_as_initiator = malloc(sizeof(nfc_modulation_type) * 9); CHIP_DATA(pnd)->supported_modulation_as_initiator = malloc(sizeof(nfc_modulation_type) * (NMT_DEP + 1));
if (! CHIP_DATA(pnd)->supported_modulation_as_initiator) if (! CHIP_DATA(pnd)->supported_modulation_as_initiator)
return NFC_ESOFT; return NFC_ESOFT;
int nbSupportedModulation = 0; int nbSupportedModulation = 0;