]> Git Repo - qemu.git/commit - blockdev.c
blockdev: Clean up abuse of DriveBackup member format
authorMarkus Armbruster <[email protected]>
Fri, 4 Nov 2022 16:06:50 +0000 (17:06 +0100)
committerMarkus Armbruster <[email protected]>
Tue, 13 Dec 2022 17:31:37 +0000 (18:31 +0100)
commit04658a5b90f48b269722631b4e51b21935a6be8d
treee38f32552e989e84183afbce0697b0ce2bd12bf5
parentceb19c8f684c7541ee878255ed686d92cfb90175
blockdev: Clean up abuse of DriveBackup member format

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 <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Hanna Reitz <[email protected]>
Cc: [email protected]
Message-Id: <20221104160712.3005652[email protected]>
Reviewed-by: Eric Blake <[email protected]>
blockdev.c
This page took 0.025953 seconds and 4 git commands to generate.