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 <arm...@redhat.com>
> Cc: Kevin Wolf <kw...@redhat.com>
> Cc: Hanna Reitz <hre...@redhat.com>
> Cc: qemu-bl...@nongnu.org
> ---
>  blockdev.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
>

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

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


Reply via email to