mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-31 05:51:53 -06:00
blkdebug: Don't leak bs->file on failure
Reported-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
5f5bcd80f8
commit
eaf944a438
1 changed files with 9 additions and 5 deletions
|
@ -396,14 +396,14 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
if (error_is_set(&local_err)) {
|
if (error_is_set(&local_err)) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto fail;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read rules from config file or command line options */
|
/* Read rules from config file or command line options */
|
||||||
config = qemu_opt_get(opts, "config");
|
config = qemu_opt_get(opts, "config");
|
||||||
ret = read_config(s, config, options, errp);
|
ret = read_config(s, config, options, errp);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
goto fail;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set initial state */
|
/* Set initial state */
|
||||||
|
@ -414,7 +414,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
flags, true, false, &local_err);
|
flags, true, false, &local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
goto fail;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set request alignment */
|
/* Set request alignment */
|
||||||
|
@ -424,11 +424,15 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
} else {
|
} else {
|
||||||
error_setg(errp, "Invalid alignment");
|
error_setg(errp, "Invalid alignment");
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto fail;
|
goto fail_unref;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
fail:
|
goto out;
|
||||||
|
|
||||||
|
fail_unref:
|
||||||
|
bdrv_unref(bs->file);
|
||||||
|
out:
|
||||||
qemu_opts_del(opts);
|
qemu_opts_del(opts);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue