Skip to content
  • Markus Armbruster's avatar
    04658a5b
    blockdev: Clean up abuse of DriveBackup member format · 04658a5b
    Markus Armbruster authored
    
    
    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: default avatarMarkus Armbruster <armbru@redhat.com>
    Cc: Kevin Wolf <kwolf@redhat.com>
    Cc: Hanna Reitz <hreitz@redhat.com>
    Cc: qemu-block@nongnu.org
    Message-Id: <20221104160712.3005652-9-armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    04658a5b
    blockdev: Clean up abuse of DriveBackup member format
    Markus Armbruster authored
    
    
    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: default avatarMarkus Armbruster <armbru@redhat.com>
    Cc: Kevin Wolf <kwolf@redhat.com>
    Cc: Hanna Reitz <hreitz@redhat.com>
    Cc: qemu-block@nongnu.org
    Message-Id: <20221104160712.3005652-9-armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Loading