projects
/
platform
/
upstream
/
btrfs-progs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c41c5b1
)
libbtrfsutil: fix memory leak in deleted_subvolumes()
author
Omar Sandoval
<osandov@fb.com>
Thu, 29 Mar 2018 07:53:54 +0000
(
00:53
-0700)
committer
David Sterba
<dsterba@suse.com>
Fri, 30 Mar 2018 20:53:57 +0000
(22:53 +0200)
If we fail to reallocate the ID array, we still need to free it.
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
libbtrfsutil/subvolume.c
patch
|
blob
|
history
diff --git
a/libbtrfsutil/subvolume.c
b/libbtrfsutil/subvolume.c
index
d6c0ced
..
867b3e1
100644
(file)
--- a/
libbtrfsutil/subvolume.c
+++ b/
libbtrfsutil/subvolume.c
@@
-1353,8
+1353,10
@@
PUBLIC enum btrfs_util_error btrfs_util_deleted_subvolumes_fd(int fd,
new_capacity = capacity ? capacity * 2 : 1;
new_ids = reallocarray(*ids, new_capacity,
sizeof(**ids));
- if (!new_ids)
- return BTRFS_UTIL_ERROR_NO_MEMORY;
+ if (!new_ids) {
+ err = BTRFS_UTIL_ERROR_NO_MEMORY;
+ goto out;
+ }
*ids = new_ids;
capacity = new_capacity;