[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 10/13] block: Simplify bdrv_append_temp_snaps
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH v3 10/13] block: Simplify bdrv_append_temp_snapshot() logic |
Date: |
Thu, 6 Apr 2017 11:00:45 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 05.04.2017 um 21:47 hat Eric Blake geschrieben:
> Noticed while checking Coccinelle results. Naming a label 'out:'
> when it is only used on error paths is weird; meanwhile we know
> that snapshot_options is NULL on success and that QDECREF(NULL)
> is safe. So merge the two exit paths into one.
>
> Signed-off-by: Eric Blake <address@hidden>
> ---
> block.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/block.c b/block.c
> index 9b87bf6..a13625f 100644
> --- a/block.c
> +++ b/block.c
> @@ -2209,13 +2209,10 @@ static BlockDriverState
> *bdrv_append_temp_snapshot(BlockDriverState *bs,
> goto out;
> }
>
> +out:
> + QDECREF(snapshot_options);
> g_free(tmp_filename);
> return bs_snapshot;
bs_snapshot is uninitialised or at least the wrong return value in error
cases. (Hm... Shouldn't the compiler catch the uninitialised part?)
> -
> -out:
> - QDECREF(snapshot_options);
> - g_free(tmp_filename);
> - return NULL;
> }
Kevin
- Re: [Qemu-devel] [PATCH v3 03/13] s390x: Drop useless casts, (continued)
- [Qemu-devel] [PATCH v3 06/13] qobject: Add helper macros for common scalar insertions, Eric Blake, 2017/04/05
- [Qemu-devel] [PATCH v3 05/13] qobject: Drop useless QObject casts, Eric Blake, 2017/04/05
- [Qemu-devel] [PATCH v3 08/13] tests: Use simpler QDict/QList scalar insertion macros, Eric Blake, 2017/04/05
- [Qemu-devel] [PATCH v3 11/13] QemuOpts: Simplify qemu_opts_to_qdict(), Eric Blake, 2017/04/05
- [Qemu-devel] [PATCH v3 10/13] block: Simplify bdrv_append_temp_snapshot() logic, Eric Blake, 2017/04/05
- Re: [Qemu-devel] [PATCH v3 10/13] block: Simplify bdrv_append_temp_snapshot() logic,
Kevin Wolf <=
[Qemu-devel] [PATCH v3 07/13] block: Use simpler QDict/QList scalar insertion macros, Eric Blake, 2017/04/05
[Qemu-devel] [PATCH v3 13/13] test-qga: Actually test 0xff sync bytes, Eric Blake, 2017/04/05
[Qemu-devel] [PATCH v3 12/13] fdc-test: Avoid deprecated 'change' command, Eric Blake, 2017/04/05