From: Erwan Velu Date: Thu, 19 Feb 2015 12:09:09 +0000 (+0100) Subject: axmap: Avoid memory leak if axmap_new() failed X-Git-Tag: fio-2.2.6~9 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=1d3fe9fd6945d4bfa14deaacc83aa9813c3f95aa;p=fio.git 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. --- 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; }