diff options
author | Max Reitz <mreitz@redhat.com> | 2019-02-01 20:29:15 +0100 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2019-02-25 15:11:26 +0100 |
commit | 6b6833c1b4d11d7d838bce34ed4a2d7c42855efe (patch) | |
tree | 7471e68e26ad34e71cde337d685274449b40bf58 /block/qapi.c | |
parent | 645ae7d88e5393a2a67ebe325f4456ecd49e33e5 (diff) |
block: bdrv_get_full_backing_filename's ret. val.
Make bdrv_get_full_backing_filename() return an allocated string instead
of placing the result in a caller-provided buffer.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Message-id: 20190201192935.18394-12-mreitz@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/qapi.c')
-rw-r--r-- | block/qapi.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/block/qapi.c b/block/qapi.c index 4623de1d7b..6002a768f8 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -296,18 +296,10 @@ void bdrv_query_image_info(BlockDriverState *bs, backing_filename = bs->backing_file; if (backing_filename[0] != '\0') { - char *backing_filename2 = g_malloc0(PATH_MAX); + char *backing_filename2; info->backing_filename = g_strdup(backing_filename); info->has_backing_filename = true; - bdrv_get_full_backing_filename(bs, backing_filename2, PATH_MAX, &err); - if (err) { - /* Can't reconstruct the full backing filename, so we must omit - * this field and apply a Best Effort to this query. */ - g_free(backing_filename2); - backing_filename2 = NULL; - error_free(err); - err = NULL; - } + backing_filename2 = bdrv_get_full_backing_filename(bs, NULL); /* Always report the full_backing_filename if present, even if it's the * same as backing_filename. That they are same is useful info. */ |