[augeas-devel] [PATCH] Eliminate memory leak in file_info().
Laine Stump
laine at redhat.com
Thu Feb 11 05:17:53 UTC 2010
From: Laine Stump <laine at laine.org>
Found with valgrind + lutter.
The result of pathjoin() was used only as an argument to tree_find(),
but wasn't being freed before return. Over the course of 12 hours or
so running the latest virt-manager, this racked up a few hundred MB of
leaked memory.
A shorter (but still valid) test of 1/2 an hour after applying the fix
showed no leaks.
---
src/transform.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/transform.c b/src/transform.c
index 39c3bda..90ce824 100644
--- a/src/transform.c
+++ b/src/transform.c
@@ -581,6 +581,7 @@ static struct tree *file_info(struct augeas *aug, const char *fname) {
result = tree_find(aug, path);
ERR_BAIL(aug);
error:
+ free(path);
return result;
}
--
1.6.6.1
More information about the augeas-devel
mailing list