Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Alexander_Naumov:SLE12
btrfsprogs
0017-Btrfs-progs-fi-usage-free-memory-if-reallo...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0017-Btrfs-progs-fi-usage-free-memory-if-realloc-fails.patch of Package btrfsprogs
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
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor