[gPXE-devel] [PATCH] [image] Fix a memleak in free_image()

Piotr Jaroszyński p.jaroszynski at gmail.com
Thu Jul 8 09:54:55 EDT 2010


image_set_cmdline() strdup()s cmdline, which free_image() doesn't clean
up.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski at gmail.com>
---

Another thing found by valgrind.

 src/core/image.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/core/image.c b/src/core/image.c
index e29d4cc..d7fed72 100644
--- a/src/core/image.c
+++ b/src/core/image.c
@@ -47,6 +47,7 @@ struct list_head images = LIST_HEAD_INIT ( images );
 static void free_image ( struct refcnt *refcnt ) {
 	struct image *image = container_of ( refcnt, struct image, refcnt );
 
+	free ( image->cmdline );
 	uri_put ( image->uri );
 	ufree ( image->data );
 	image_put ( image->replacement );
-- 
1.7.1



More information about the gPXE-devel mailing list