From 1d3fe9fd6945d4bfa14deaacc83aa9813c3f95aa Mon Sep 17 00:00:00 2001 From: Erwan Velu Date: Thu, 19 Feb 2015 13:09:09 +0100 Subject: [PATCH] axmap: Avoid memory leak if axmap_new() failed The axmap_new() function implements an exit path using the label "err" to free the alloced memory. That cleanup code was cleaning all the sub malloc structures but not the main structure (axmap) itself resulting in a memory leak of sizeof(struct axmap) bytes. This simple patch just free axmap at the end of the cleanup code. --- lib/axmap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/axmap.c b/lib/axmap.c index 164300f2..195d333c 100644 --- a/lib/axmap.c +++ b/lib/axmap.c @@ -125,6 +125,7 @@ err: free(axmap->levels[i].map); free(axmap->levels); + free(axmap); return NULL; } -- 2.25.1