]> www.infradead.org Git - mtd-utils.git/commit
ubifs-utils: common: fix memory leak in devtable.c
authorAntonMoryakov <ant.v.moryakov@gmail.com>
Thu, 24 Apr 2025 18:19:22 +0000 (21:19 +0300)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Mon, 2 Jun 2025 05:23:41 +0000 (07:23 +0200)
commit2669111e3c60b8e146c174db5d2e7e9991f3dd87
tree8a66a14b644972c62f43de689c6377e818275834
parent8a83b306db64d6f60186d4396b0b770163b85b6e
ubifs-utils: common: fix memory leak in devtable.c

Report of the static analyzer:
Dynamic memory, referenced by 'line', is allocated at devtable.c:356
by calling function 'getline' and lost at devtable.c:388.
(line: while (getline(&line, &len, f) != -1) {)

Correct explained:
Now line is freed in any exit scenario via out_close which eliminates this error.

Triggers found by static analyzer Svace.

Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.co
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
ubifs-utils/common/devtable.c