summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwan Velu <erwan.velu@enovance.com>2015-02-19 13:09:09 +0100
committerMohamad Ayyash <mkayyash@google.com>2015-03-06 17:58:17 -0800
commit534e19ca4a2646911326bcd4a7f71988a5b9c41f (patch)
treec52318d9758b39317b1664330aacd7cf065ba0a4
parenta8ad8ddc987c2c50c69ec070ed7e7e62500f34a5 (diff)
downloadfio-534e19ca4a2646911326bcd4a7f71988a5b9c41f.tar.gz
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.
-rw-r--r--lib/axmap.c1
1 files changed, 1 insertions, 0 deletions
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;
}