btrfsprogs/0017-Btrfs-progs-fi-usage-free-memory-if-realloc-fails.patch
David Sterba 3ee7e4de90 Accepting request 259501 from home:dsterba:branches:filesystems
- version 3.17
  - check: --init-csum-tree acutally does something useful, rebuilds the whole
    csum tree
  - /dev scanning for btrfs devices is gone
  - /proc/partitions scanning is gone, blkid is used exclusively
  - new subcommand subvolume sync
  - filesystem df: new options to set unit format
  - convert: allow to copy label from the origin, or specify a new one

(not all local patches are upstream, maybe next time)

OBS-URL: https://build.opensuse.org/request/show/259501
OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsprogs?expand=0&rev=176
2014-11-03 13:17:26 +00:00

39 lines
1.1 KiB
Diff

From 9102adcbc8521dfee5da2fd86b6f8333ee89f3d8 Mon Sep 17 00:00:00 2001
From: Rakesh Pandit <rakesh@tuxera.com>
Date: Sat, 19 Apr 2014 14:12:03 +0300
Subject: [PATCH 08/42] Btrfs-progs: fi usage: free memory if realloc fails
Lets not assign *info_ptr to 0 before calling free on it and lose
track of already allocated memory if realloc fails in
add_info_to_list. Lets call free first.
Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
---
cmds-fi-disk_usage.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
index 736294eea3da..9fd59bc1b5ae 100644
--- a/cmds-fi-disk_usage.c
+++ b/cmds-fi-disk_usage.c
@@ -104,6 +104,7 @@ static int add_info_to_list(struct chunk_info **info_ptr,
struct chunk_info *res = realloc(*info_ptr, size);
if (!res) {
+ free(*info_ptr);
fprintf(stderr, "ERROR: not enough memory\n");
return -1;
}
@@ -224,7 +225,6 @@ static int load_chunk_info(int fd,
if (add_info_to_list(info_ptr, info_count, item)) {
*info_ptr = 0;
- free(*info_ptr);
return -100;
}
--
2.1.1