The two branches that return NULL can be put under a single branch because the qemu_opts_del function can take a NULL opt. The next patch will add common cleanup code to the error path so change this now to avoid code duplication.
Signed-off-by: Fabiano Rosas <[email protected]> --- util/qemu-option.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/util/qemu-option.c b/util/qemu-option.c index 557d5d929c..e115e1acef 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -900,12 +900,8 @@ static QemuOpts *opts_parse(QemuOptsList *list, const char *params, opts = qemu_opts_create(list, id, !list->merge_lists, errp); g_free(id); - if (opts == NULL) { - return NULL; - } - - if (!opts_do_parse(opts, params, firstname, - warn_on_flag, help_wanted, errp)) { + if (!opts || !opts_do_parse(opts, params, firstname, + warn_on_flag, help_wanted, errp)) { qemu_opts_del(opts); return NULL; } -- 2.53.0
