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:
2550112
)
erofs-utils: fsck: Fix potential memory leak in error path
author
Sandeep Dhavale
<dhavale@google.com>
Wed, 13 Sep 2023 22:10:58 +0000
(15:10 -0700)
committer
Gao Xiang
<hsiangkao@linux.alibaba.com>
Thu, 14 Sep 2023 02:53:38 +0000
(10:53 +0800)
Free the memory allocated for 'entry' if strdup() fails.
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
Link:
https://lore.kernel.org/r/20230913221104.429825-2-dhavale@google.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
fsck/main.c
patch
|
blob
|
history
diff --git
a/fsck/main.c
b/fsck/main.c
index 7f78513c385e8e13793118be006ec160d5047068..3f86da4bdd206bfb521bf71cd9d062558aa42892 100644
(file)
--- a/
fsck/main.c
+++ b/
fsck/main.c
@@
-585,8
+585,10
@@
static int erofsfsck_hardlink_insert(erofs_nid_t nid, const char *path)
entry->nid = nid;
entry->path = strdup(path);
- if (!entry->path)
+ if (!entry->path) {
+ free(entry);
return -ENOMEM;
+ }
list_add_tail(&entry->list,
&erofsfsck_link_hashtable[nid % NR_HARDLINK_HASHTABLE]);