mirror of https://github.com/xemu-project/xemu.git
qemu-option: Fix uninitialized value in append_option_parameter
When dest is NULL, i.e. a new copy of the list is created, we don't get a properly terminated list after the realloc. Initialize it as an empty list. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
271248886e
commit
bd69fe8448
|
@ -378,6 +378,7 @@ QEMUOptionParameter *append_option_parameters(QEMUOptionParameter *dest,
|
||||||
num_options += count_option_parameters(list);
|
num_options += count_option_parameters(list);
|
||||||
|
|
||||||
dest = qemu_realloc(dest, (num_options + 1) * sizeof(QEMUOptionParameter));
|
dest = qemu_realloc(dest, (num_options + 1) * sizeof(QEMUOptionParameter));
|
||||||
|
dest[num_dest_options].name = NULL;
|
||||||
|
|
||||||
while (list && list->name) {
|
while (list && list->name) {
|
||||||
if (get_option_parameter(dest, list->name) == NULL) {
|
if (get_option_parameter(dest, list->name) == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue