From patchwork Fri Jun 11 08:19:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 55298 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6E612B7D59 for ; Fri, 11 Jun 2010 18:22:25 +1000 (EST) Received: from localhost ([127.0.0.1]:55799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMzVO-0004jG-El for incoming@patchwork.ozlabs.org; Fri, 11 Jun 2010 04:22:22 -0400 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 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5B8JuAe032210 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 11 Jun 2010 04:19:56 -0400 Received: from localhost.localdomain (vpn2-10-11.ams2.redhat.com [10.36.10.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5B8JrtI017969; Fri, 11 Jun 2010 04:19:54 -0400 From: Kevin Wolf To: qemu-devel@nongnu.org Date: Fri, 11 Jun 2010 10:19:41 +0200 Message-Id: <1276244381-7569-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: kwolf@redhat.com, xudong.hao@intel.com, morita.kazutaka@lab.ntt.co.jp Subject: [Qemu-devel] [PATCH] qemu-option: Fix uninitialized value in append_option_parameter X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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) {