btrfsprogs/0017-Btrfs-progs-fi-usage-free-memory-if-realloc-fails.patch
Stephan Kulow fee391e33a Accepting request 232437 from filesystems
- update to upstream 3.14.1
- mkfs:
  - fix TRIM detection
  - do not zero-out end of device unconditionally
  - no crash with --features option
- fsck:
  - clear log tree in repair mode
  - check reloc roots
- btrfs - reworked space reporting (bnc#873106)
  - btrfs fi usage - new command
  - btrfs dev usage - new command
  - btrfs fi df - enhanced output with GlobalReserve
- Removed patches:
  * 0001-btrfs-progs-move-arg_strtou64-to-a-separate-file-for.patch
- Added patches:
  * 0001-Btrfs-progs-fix-check-to-test-trim-support.patch
  * 0002-Btrfs-progs-fsck-fix-double-free-memory-crash.patch
  * 0003-Btrfs-progs-mkfs-Remove-zero_end-1-since-it-has-been.patch
  * 0004-btrfs-progs-fix-wrong-max-system-array-size-check-in.patch
  * 0005-btrfs-progs-move-arg_strtou64-to-a-separate-file-for.patch
  * 0006-Btrfs-progs-fsck-clear-out-log-tree-in-repair-mode.patch
  * 0007-Btrfs-progs-fsck-avoid-pinning-same-block-several-ti.patch
  * 0008-Btrfs-progs-fsck-add-ability-to-check-reloc-roots.patch
  * 0009-btrfs-progs-prevent-close_root-if-the-root-to-close-.patch
  * 0010-btrfs-progs-fix-mkfs.btrfs-segfault-with-features-op.patch
  * 0011-btrfs-progs-Enhance-the-command-btrfs-filesystem-df.patch
  * 0012-btrfs-progs-Add-helpers-functions-to-handle-the-prin.patch
  * 0013-btrfs-progs-Add-command-btrfs-filesystem-disk-usage.patch
  * 0014-btrfs-progs-Add-btrfs-device-disk-usage-command.patch
  * 0015-btrfs-progs-cleanup-dead-return-after-usage-for-fi-d.patch
  * 0016-btrfs-progs-Fix-memleak-in-get_raid56_used.patch
  * 0017-Btrfs-progs-fi-usage-free-memory-if-realloc-fails.patch
  * 0018-btrfs-progs-read-global-reserve-size-from-space-info.patch
  * 0019-btrfs-progs-add-original-df-and-rename-disk_usage-to.patch
  * 0020-btrfs-progs-move-device-usage-to-cmds-device-more-cl.patch
  * 0021-btrfs-progs-check-if-we-can-t-get-info-from-ioctls-d.patch
  * 0022-btrfs-progs-zero-out-structures-before-calling-ioctl.patch
  * 0023-btrfs-progs-print-B-for-bytes.patch
  * 0024-btrfs-progs-Print-more-info-about-device-sizes.patch
  * 0025-btrfs-progs-compare-unallocated-space-against-the-co.patch
  * 0026-btrfs-progs-add-section-of-overall-filesystem-usage.patch
  * 0027-btrfs-progs-cleanup-filesystem-device-usage-code.patch
  * 0028-btrfs-progs-extend-pretty-printers-with-unit-mode.patch
  * 0029-btrfs-progs-replace-df_pretty_sizes-with-pretty_size.patch
  * 0030-btrfs-progs-clean-up-return-codes-and-paths.patch
  * 0031-btrfs-progs-move-global-reserve-to-overall-summary.patch (forwarded request 232435 from dsterba)

OBS-URL: https://build.opensuse.org/request/show/232437
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/btrfsprogs?expand=0&rev=40
2014-05-06 11:39:23 +00:00

39 lines
1.1 KiB
Diff

From b43d0660526d1a3e81f34fd499eb1dd038b00e08 Mon Sep 17 00:00:00 2001
From: Rakesh Pandit <rakesh@tuxera.com>
Date: Sat, 19 Apr 2014 14:12:03 +0300
Subject: [PATCH 28/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 2bd591db0f8a..cd71c8da3cf4 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;
}
--
1.9.0