From patchwork Fri Jan 13 10:51:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 135799 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 33E33B6F6F for ; Fri, 13 Jan 2012 22:28:04 +1100 (EST) Received: from localhost ([::1]:55217 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlemJ-0002zd-5J for incoming@patchwork.ozlabs.org; Fri, 13 Jan 2012 05:54:35 -0500 Received: from eggs.gnu.org ([140.186.70.92]:42664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rlem2-0002W5-Ad for qemu-devel@nongnu.org; Fri, 13 Jan 2012 05:54:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rlelm-0001Ue-E4 for qemu-devel@nongnu.org; Fri, 13 Jan 2012 05:54:08 -0500 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:34647) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rlelm-0001Na-72 for qemu-devel@nongnu.org; Fri, 13 Jan 2012 05:54:02 -0500 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 13 Jan 2012 10:53:16 -0000 Received: from d06nrmr1707.portsmouth.uk.ibm.com ([9.149.39.225]) by e06smtp11.uk.ibm.com ([192.168.101.141]) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 13 Jan 2012 10:52:56 -0000 Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q0DAqtYI2592910 for ; Fri, 13 Jan 2012 10:52:55 GMT Received: from d06av01.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q0DAqtC5018451 for ; Fri, 13 Jan 2012 03:52:55 -0700 Received: from localhost (stefanha-thinkpad.manchester-maybrook.uk.ibm.com [9.174.219.31]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q0DAqt2l018448; Fri, 13 Jan 2012 03:52:55 -0700 From: Stefan Hajnoczi To: Anthony Liguori Date: Fri, 13 Jan 2012 10:51:36 +0000 Message-Id: <1326451900-18325-9-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1326451900-18325-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1326451900-18325-1-git-send-email-stefanha@linux.vnet.ibm.com> x-cbid: 12011310-5024-0000-0000-0000015D8E41 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 195.75.94.107 Cc: qemu-devel@nongnu.org, Stefan Hajnoczi , Stefan Berger Subject: [Qemu-devel] [PATCH 08/12] hmp: Fix freeing of PciInfoList X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Stefan Berger Remember the original PciInfoList in info_list and use the info variable to traverse the list. Signed-off-by: Stefan Berger Signed-off-by: Stefan Hajnoczi --- hmp.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hmp.c b/hmp.c index e7659d5..fd4f755 100644 --- a/hmp.c +++ b/hmp.c @@ -486,17 +486,17 @@ static void hmp_info_pci_device(Monitor *mon, const PciDeviceInfo *dev) void hmp_info_pci(Monitor *mon) { - PciInfoList *info; + PciInfoList *info_list, *info; Error *err = NULL; - info = qmp_query_pci(&err); + info_list = qmp_query_pci(&err); if (err) { monitor_printf(mon, "PCI devices not supported\n"); error_free(err); return; } - for (; info; info = info->next) { + for (info = info_list; info; info = info->next) { PciDeviceInfoList *dev; for (dev = info->value->devices; dev; dev = dev->next) { @@ -504,7 +504,7 @@ void hmp_info_pci(Monitor *mon) } } - qapi_free_PciInfoList(info); + qapi_free_PciInfoList(info_list); } void hmp_quit(Monitor *mon, const QDict *qdict)