mirror of https://github.com/xemu-project/xemu.git
qemu-option: Fix qemu_opts_find() for null id arguments
Crashes when the first list member has an ID. Admittedly nonsensical reproducer: $ qemu-system-x86_64 -nodefaults -machine id=foo -machine "" Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1372943363-24081-2-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
154bb106dc
commit
96bc97ebf3
|
@ -706,16 +706,12 @@ QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id)
|
||||||
QemuOpts *opts;
|
QemuOpts *opts;
|
||||||
|
|
||||||
QTAILQ_FOREACH(opts, &list->head, next) {
|
QTAILQ_FOREACH(opts, &list->head, next) {
|
||||||
if (!opts->id) {
|
if (!opts->id && !id) {
|
||||||
if (!id) {
|
return opts;
|
||||||
return opts;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (strcmp(opts->id, id) != 0) {
|
if (opts->id && id && !strcmp(opts->id, id)) {
|
||||||
continue;
|
return opts;
|
||||||
}
|
}
|
||||||
return opts;
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue