From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=51939 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMzT7-0003Ft-EB for qemu-devel@nongnu.org; Fri, 11 Jun 2010 04:20:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OMzT6-0001KT-Gr for qemu-devel@nongnu.org; Fri, 11 Jun 2010 04:20:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28529) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OMzT6-0001KN-7a for qemu-devel@nongnu.org; Fri, 11 Jun 2010 04:20:00 -0400 From: Kevin Wolf Date: Fri, 11 Jun 2010 10:19:41 +0200 Message-Id: <1276244381-7569-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH] qemu-option: Fix uninitialized value in append_option_parameter List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, xudong.hao@intel.com, morita.kazutaka@lab.ntt.co.jp 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 --- Xudong, can you please try this one? I think it should fix your qemu-img problem. qemu-option.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/qemu-option.c b/qemu-option.c index acd74f9..f884865 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -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) { -- 1.6.6.1