summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-04-12 17:59:47 +0100
committerRichard W.M. Jones <rjones@redhat.com>2011-04-12 17:59:47 +0100
commit41c6e04831b0a6c6b1b15075d9f7c30b6c95e72b (patch)
treeddaa5c7b0dd65a5258496c31a8f3ceaecdf40dc1
parent0b317929f9b76fc06ddca1abd7f7b1ae3b548070 (diff)
downloadhivex-41c6e04831b0a6c6b1b15075d9f7c30b6c95e72b.tar.gz
hivex-41c6e04831b0a6c6b1b15075d9f7c30b6c95e72b.tar.xz
hivex-41c6e04831b0a6c6b1b15075d9f7c30b6c95e72b.zip
Fix use-after-free in hivex_close.
Found using valgrind.
-rw-r--r--lib/hivex.c6
1 files 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;
}