search for: 26757d4fb

Displaying 2 results from an estimated 2 matches for "26757d4fb".

2017 Nov 03
1
[PATCH] daemon: btrfs: fix bad handling of a couple of errors
...rectly, instead of jumping to 'error' - if the strdup() for 'btrfsbalance_status' fails, then the directly return would leak 'ret' --- daemon/btrfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index d363ada6d..26757d4fb 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1686,7 +1686,7 @@ do_btrfs_balance_status (const char *path) ret = calloc (1, sizeof *ret); if (ret == NULL) { reply_with_perror ("calloc"); - goto error; + return NULL; } /* Output of `btrfs balance status'...
2018 Aug 06
1
[PATCH] btrfs_balance_status: delay allocation of 'ret'
Allocate 'ret' as late as possible, so there is no risk that early returns will leak it. --- daemon/btrfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 26757d4fb..5c4be6cf7 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -1683,12 +1683,6 @@ do_btrfs_balance_status (const char *path) nlines = guestfs_int_count_strings (lines); - ret = calloc (1, sizeof *ret); - if (ret == NULL) { - reply_with_perror ("calloc"); - return NULL; -...