@@ -408,9 +408,7 @@ int bdrv_create(BlockDriver *drv, const char* filename, QemuOpts *opts)
ret = cco.ret;
out:
- if (!opts) {
- qemu_opts_del(cco.opts);
- }
+ qemu_opts_del(cco.opts);
g_free(cco.filename);
return ret;
}
@@ -4575,9 +4573,7 @@ void bdrv_img_create(const char *filename, const char *fmt,
}
out:
- if (opts) {
- qemu_opts_del(opts);
- }
+ qemu_opts_del(opts);
qemu_opts_free(create_opts);
if (bs) {
@@ -768,9 +768,7 @@ static void device_initfn(Object *obj)
static void device_finalize(Object *obj)
{
DeviceState *dev = DEVICE(obj);
- if (dev->opts) {
- qemu_opts_del(dev->opts);
- }
+ qemu_opts_del(dev->opts);
}
static void device_class_base_init(ObjectClass *class, void *data)
@@ -3379,9 +3379,7 @@ void qemu_chr_delete(CharDriverState *chr)
}
g_free(chr->filename);
g_free(chr->label);
- if (chr->opts) {
- qemu_opts_del(chr->opts);
- }
+ qemu_opts_del(chr->opts);
g_free(chr);
}
@@ -1527,9 +1527,7 @@ static int img_convert(int argc, char **argv)
out:
qemu_progress_end();
qemu_opts_free(create_opts);
- if (opts) {
- qemu_opts_del(opts);
- }
+ qemu_opts_del(opts);
qemu_vfree(buf);
if (out_bs) {
bdrv_delete(out_bs);
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> --- block.c | 8 ++------ hw/core/qdev.c | 4 +--- qemu-char.c | 4 +--- qemu-img.c | 4 +--- 4 files changed, 5 insertions(+), 15 deletions(-)