From: Omar Sandoval <osan...@fb.com> If we fail to reallocate the ID array, we still need to free it.
Signed-off-by: Omar Sandoval <osan...@fb.com> --- libbtrfsutil/subvolume.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libbtrfsutil/subvolume.c b/libbtrfsutil/subvolume.c index d6c0ced8..867b3e10 100644 --- 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; -- 2.16.3 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html