Correct ftdi_eeprom_free()
authorUwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Wed, 8 Sep 2010 12:58:43 +0000 (14:58 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 20 Sep 2010 13:34:36 +0000 (15:34 +0200)
src/ftdi.c

index 78a7f4e..2a39a45 100644 (file)
@@ -2223,25 +2223,24 @@ void ftdi_eeprom_initdefaults(struct ftdi_context *ftdi)
 */
 void ftdi_eeprom_free(struct ftdi_context *ftdi)
 {
-    struct ftdi_eeprom *eeprom;
     if (!ftdi)
         return;
     if (ftdi->eeprom)
-        return;
-
-    eeprom = ftdi->eeprom;
+    {
+        struct ftdi_eeprom *eeprom = ftdi->eeprom;
 
-    if (eeprom->manufacturer != 0) {
-        free(eeprom->manufacturer);
-        eeprom->manufacturer = 0;
-    }
-    if (eeprom->product != 0) {
-        free(eeprom->product);
-        eeprom->product = 0;
-    }
-    if (eeprom->serial != 0) {
-        free(eeprom->serial);
-        eeprom->serial = 0;
+        if (eeprom->manufacturer != 0) {
+            free(eeprom->manufacturer);
+            eeprom->manufacturer = 0;
+        }
+        if (eeprom->product != 0) {
+            free(eeprom->product);
+            eeprom->product = 0;
+        }
+        if (eeprom->serial != 0) {
+            free(eeprom->serial);
+            eeprom->serial = 0;
+        }
     }
 }