preproc.c: Fix use-after-free bug
authorCyrill Gorcunov <gorcunov@gmail.com>
Thu, 3 Mar 2011 06:18:56 +0000 (09:18 +0300)
committerCyrill Gorcunov <gorcunov@gmail.com>
Sat, 5 Mar 2011 20:54:49 +0000 (23:54 +0300)
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
preproc.c

index 2f3dda4..75f9980 100644 (file)
--- a/preproc.c
+++ b/preproc.c
@@ -5324,12 +5324,12 @@ static void pp_cleanup(int pass)
         istk = istk->next;
         fclose(i->fp);
         nasm_free(i->fname);
-        nasm_free(i);
         while (i->expansion != NULL) {
             ExpInv *ei = i->expansion;
             i->expansion = ei->prev;
             free_expinv(ei);
         }
+        nasm_free(i);
     }
     while (cstk)
         ctx_pop();