qemu-option: Fix uninitialized value in append_option_parameter
authorKevin Wolf <kwolf@redhat.com>
Fri, 11 Jun 2010 08:19:41 +0000 (10:19 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 14 Jun 2010 16:12:53 +0000 (11:12 -0500)
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>
qemu-option.c

index acd74f91247f5b8d21e008152e3ea8b7c9e9da44..f88486580cdd6cd406d1d0fc390874b6df8e3bad 100644 (file)
@@ -378,6 +378,7 @@ QEMUOptionParameter *append_option_parameters(QEMUOptionParameter *dest,
     num_options += count_option_parameters(list);
 
     dest = qemu_realloc(dest, (num_options + 1) * sizeof(QEMUOptionParameter));
+    dest[num_dest_options].name = NULL;
 
     while (list && list->name) {
         if (get_option_parameter(dest, list->name) == NULL) {