projects
/
platform
/
upstream
/
erofs-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d069bab
)
erofs-utils: lib: Fix memory leak if __erofs_battach() fails
author
Sandeep Dhavale
<dhavale@google.com>
Wed, 13 Sep 2023 22:11:00 +0000
(15:11 -0700)
committer
Gao Xiang
<hsiangkao@linux.alibaba.com>
Thu, 14 Sep 2023 02:53:38 +0000
(10:53 +0800)
Need to free allocated buffer_head bh if __erofs_battach() fails.
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
Link:
https://lore.kernel.org/r/20230913221104.429825-4-dhavale@google.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
lib/cache.c
patch
|
blob
|
history
diff --git
a/lib/cache.c
b/lib/cache.c
index 5205d573d2c75d555da3c9ce9787702ef3e1f6f5..a9948f0499e99bb228dab8eb137e5579733a4c82 100644
(file)
--- a/
lib/cache.c
+++ b/
lib/cache.c
@@
-282,8
+282,10
@@
struct erofs_buffer_head *erofs_balloc(int type, erofs_off_t size,
ret = __erofs_battach(bb, bh, size, alignsize,
required_ext + inline_ext, false);
- if (ret < 0)
+ if (ret < 0) {
+ free(bh);
return ERR_PTR(ret);
+ }
return bh;
}