From 41c6e04831b0a6c6b1b15075d9f7c30b6c95e72b Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 12 Apr 2011 17:59:47 +0100 Subject: [PATCH] Fix use-after-free in hivex_close. Found using valgrind. --- lib/hivex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; } -- 1.8.3.1