qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 08/30] blockdev: Clean up abuse of DriveBackup member form


From: Eric Blake
Subject: Re: [PATCH v3 08/30] blockdev: Clean up abuse of DriveBackup member format
Date: Fri, 4 Nov 2022 14:32:46 -0500
User-agent: NeoMutt/20220429

On Fri, Nov 04, 2022 at 05:06:50PM +0100, Markus Armbruster wrote:
> drive-backup argument @format defaults to the format of the source
> unless @mode is "existing".
> 
> drive_backup_prepare() implements this by copying the source's
> @format_name to DriveBackup member @format.  It leaves @has_format
> false, violating the "has_format == !!format" invariant.  Unclean.
> Falls apart when we elide @has_format (commit after next): then QAPI
> passes @format, which is a string constant, to g_free().  iotest 056
> duly explodes.
> 
> Clean it up.  Since the value stored in member @format is not actually
> used outside this function, use a local variable instead of modifying
> the QAPI object.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Hanna Reitz <hreitz@redhat.com>
> Cc: qemu-block@nongnu.org
> ---
>  blockdev.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
>

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]