diff options
author | Erwan Velu <erwan.velu@enovance.com> | 2015-02-19 13:09:09 +0100 |
---|---|---|
committer | Mohamad Ayyash <mkayyash@google.com> | 2015-03-06 17:58:17 -0800 |
commit | 534e19ca4a2646911326bcd4a7f71988a5b9c41f (patch) | |
tree | c52318d9758b39317b1664330aacd7cf065ba0a4 | |
parent | a8ad8ddc987c2c50c69ec070ed7e7e62500f34a5 (diff) | |
download | fio-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.c | 1 |
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; } |