summaryrefslogtreecommitdiff
path: root/lib/image-sparse.c
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2018-11-14 01:10:53 -0800
committerYe Li <ye.li@nxp.com>2020-04-26 23:26:27 -0700
commitdd33947fa209bab6db5e32f2300e6498c691db05 (patch)
tree1e3fcf72bfbc99ce90e072176365e3e633c0128c /lib/image-sparse.c
parenta24fc810e36ea947436791c857e7c6c43ecc8300 (diff)
MLK-20356-1 common: Fix resource leak in sparse image writting
Fix coverity issue CID 18031: Resource leak (RESOURCE_LEAK) leaked_storage: Variable fill_buf going out of scope leaks the storage it points to Should free the fill_buf before function return. Signed-off-by: Ye Li <ye.li@nxp.com> (cherry picked from commit bc23ae569c7aaea338648c000b7b733b09eb735a) (cherry picked from commit 0a496da0851e981b0ab19338145fcb622762af94)
Diffstat (limited to 'lib/image-sparse.c')
-rw-r--r--lib/image-sparse.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/image-sparse.c b/lib/image-sparse.c
index 34e777e4f5f..96d1395558d 100644
--- a/lib/image-sparse.c
+++ b/lib/image-sparse.c
@@ -197,6 +197,7 @@ int write_sparse_image(struct sparse_storage *info,
__func__);
info->mssg("Request would exceed partition size!",
response);
+ free(fill_buf);
return -1;
}