]> git.itanic.dy.fi Git - scan-pagemap/commitdiff
parse_pagemap: Fix massive memory leak
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 3 Jul 2010 19:37:37 +0000 (22:37 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sat, 3 Jul 2010 19:37:37 +0000 (22:37 +0300)
When matching pageframe is found from the tree, the allocated one
should be freed as it is not used anymore.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
parse.c

diff --git a/parse.c b/parse.c
index 79f52a86e34ac096bbf769a9d6e230f12a7fd62f..5b7933ba7afd6be735b481d9ad97a434e7166199 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -152,6 +152,8 @@ static int parse_pageframe(FILE *file, struct pageframe *pf_tree,
                                bintree_add(&pf_tree->tree,
                                        &pageframe->tree, &pageframe_ops));
 
+                       if (match != pageframe)
+                               free(pageframe);
                        match->refcount++;
                        /*
                         * Add a link from the physical page to this