From: Richard W.M. Jones Date: Tue, 12 Apr 2011 16:59:47 +0000 (+0100) Subject: Fix use-after-free in hivex_close. X-Git-Tag: 1.2.5~6 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=41c6e04831b0a6c6b1b15075d9f7c30b6c95e72b;p=hivex.git Fix use-after-free in hivex_close. Found using valgrind. --- diff --git a/lib/hivex.c b/lib/hivex.c index 8a774de..860c85c 100644 --- a/lib/hivex.c +++ b/lib/hivex.c @@ -534,6 +534,9 @@ hivex_close (hive_h *h) { int r; + if (h->msglvl >= 1) + fprintf (stderr, "hivex_close\n"); + free (h->bitmap); if (!h->writable) munmap (h->addr, h->size); @@ -543,9 +546,6 @@ hivex_close (hive_h *h) free (h->filename); free (h); - if (h->msglvl >= 1) - fprintf (stderr, "hivex_close\n"); - return r; }