Check malloc(3) return value.

This commit is contained in:
Romain Tartière 2015-04-15 17:11:14 +02:00
parent 65894ca3b4
commit f6c7f7692b

View file

@ -474,7 +474,8 @@ mifare_cryto_postprocess_data (MifareTag tag, void *data, ssize_t *nbytes, int c
}
edl = enciphered_data_length (tag, *nbytes - 1, communication_settings);
edata = malloc (edl);
if (!(edata = malloc (edl)))
abort ();
memcpy (edata, data, *nbytes - 1);
memset ((uint8_t *)edata + *nbytes - 1, 0, edl - *nbytes + 1);