Don't crash in ftdi_eeprom_free() if eeprom is unallocated/already freed
[libftdi] / src / ftdi.c
index 4d10b73..2db8d32 100644 (file)
@@ -2138,6 +2138,9 @@ void ftdi_eeprom_initdefaults(struct ftdi_eeprom *eeprom)
 */
 void ftdi_eeprom_free(struct ftdi_eeprom *eeprom)
 {
+    if (!eeprom)
+        return;
+
     if (eeprom->manufacturer != 0) {
         free(eeprom->manufacturer);
         eeprom->manufacturer = 0;