Add Elf/Phdr/Scn alloc/destroy
[centaur.git] / src / elfucli.c
index cd8f0baa378d618dba1a2076e86706348ec124e1..b3ea29f2440381c68f685c051215cdc3da8cdc27 100644 (file)
@@ -84,6 +84,10 @@ int main(int argc, char **argv)
         }
         break;
       case 'i':
+        if (me) {
+          elfu_mElfDestroy(me);
+        }
+
         printf("Opening input file %s.\n", optarg);
         openElf(&hIn, optarg, ELF_C_READ);
         if (!hIn.e) {
@@ -200,6 +204,10 @@ int main(int argc, char **argv)
 
 
 EXIT:
+  if (me) {
+    elfu_mElfDestroy(me);
+  }
+
   if (hIn.e) {
     closeElf(&hIn);
   }