From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:47407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROTsE-0003gC-49 for qemu-devel@nongnu.org; Thu, 10 Nov 2011 07:36:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ROTsC-0005tz-M3 for qemu-devel@nongnu.org; Thu, 10 Nov 2011 07:36:54 -0500 Received: from mtagate2.uk.ibm.com ([194.196.100.162]:34123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROTsC-0005tF-5i for qemu-devel@nongnu.org; Thu, 10 Nov 2011 07:36:52 -0500 Received: from d06nrmr1806.portsmouth.uk.ibm.com (d06nrmr1806.portsmouth.uk.ibm.com [9.149.39.193]) by mtagate2.uk.ibm.com (8.13.1/8.13.1) with ESMTP id pAACao4t024354 for ; Thu, 10 Nov 2011 12:36:50 GMT Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pAACao3H2646174 for ; Thu, 10 Nov 2011 12:36:50 GMT Received: from d06av10.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pAACaomL025517 for ; Thu, 10 Nov 2011 05:36:50 -0700 From: Stefan Hajnoczi Date: Thu, 10 Nov 2011 12:36:42 +0000 Message-Id: <1320928604-6642-7-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1320928604-6642-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1320928604-6642-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 6/8] x86/cpuid: Plug memory leak in cpudef_setfield() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Markus Armbruster , Stefan Hajnoczi From: Markus Armbruster To reproduce the leak, put two name options into the same [cpudef] section of target-x86_64.conf. Signed-off-by: Markus Armbruster Signed-off-by: Stefan Hajnoczi --- target-i386/cpuid.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index 352c390..99cff65 100644 --- a/target-i386/cpuid.c +++ b/target-i386/cpuid.c @@ -950,6 +950,7 @@ static int cpudef_setfield(const char *name, const char *str, void *opaque) int err = 0; if (!strcmp(name, "name")) { + g_free((void *)def->name); def->name = g_strdup(str); } else if (!strcmp(name, "model_id")) { strncpy(def->model_id, str, sizeof (def->model_id)); -- 1.7.7.1