Displaying 2 results from an estimated 2 matches for "subptr2".
Did you mean:
subptr1
2015 Jun 18
1
Re: [PATCH v4 2/3] do_btrfs_subvolume_list: fix a bad return value
...(1) above,
with no need to switch from malloc to calloc.
The other alternative is to use more labels for error conditions in a
symmetric way, like:
ptr1 = malloc (...);
if (ptr1 == NULL)
goto error1;
ptr1->subptr1 = malloc (...);
if (ptr1->subptr1 == NULL)
goto error2;
ptr1->subptr2 = malloc (...);
if (ptr1->subptr2 == NULL)
goto error3;
...
error3:
free (ptr1->subptr1);
error2:
free (ptr1);
error1:
...
--
Pino Toscano
2015 Jun 17
2
Re: [PATCH v4 2/3] do_btrfs_subvolume_list: fix a bad return value
On Wednesday 17 June 2015 16:19:32 Chen Hanxiao wrote:
> don't return a value which is to be freed.
>
> v4: use strndup
> v3: v3: fix test case failure
> Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
> ---
> daemon/btrfs.c | 26 +++++++++++++++++---------
> 1 file changed, 17 insertions(+), 9 deletions(-)
>
> diff --git a/daemon/btrfs.c