From nobody Mon May 13 03:49:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1563351609; cv=none; d=zoho.com; s=zohoarc; b=CXONDog/zM6PlmT1jVmGT4wWjoTUBJJ/kjyajGaQ39kAF3mdQWT+FzIO8SkSZF4Hw7iilimly3d3uOrcShOqdf0n7KXudufUWdcdE12qzj1djq5MZqQ1PYafPseSpMaFKg86pCqf2meqKbBKmI6LWIRts2JPZqRI7L8HRYZcYqI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563351609; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=g6gsKDB+pdVDh4YLgYrqBXVKZkJd0VRsR23RqvO2BNU=; b=VRCkmIrOBwudDyJ3v4F6MraU6Af4px9y4wTgQgSGgB1mucAPDxfcvNYFI/f/lPF9XD3p1xBljSQuscXyUPdnLzcrPpOT/7lB48XYA/iJ5e6OgT8+OVr2Gs9bNKyPZab0JJhhtlKskDgfN9uZDahXROK2E3o6xpbhOp2kTsMiAls= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156335160984758.272365885945305; Wed, 17 Jul 2019 01:20:09 -0700 (PDT) Received: from localhost ([::1]:54918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hnfAU-0001jV-Uq for importer@patchew.org; Wed, 17 Jul 2019 04:20:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42499) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hnfAH-00019h-PE for qemu-devel@nongnu.org; Wed, 17 Jul 2019 04:19:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hnfAG-0002xq-Rx for qemu-devel@nongnu.org; Wed, 17 Jul 2019 04:19:53 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:17884) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hnfAG-0002xA-Go for qemu-devel@nongnu.org; Wed, 17 Jul 2019 04:19:52 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6H8I1P1058896 for ; Wed, 17 Jul 2019 04:19:51 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tsw24889h-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 17 Jul 2019 04:19:50 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 17 Jul 2019 09:19:48 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 17 Jul 2019 09:19:46 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6H8JjxA49217594 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Jul 2019 08:19:45 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2790B42052; Wed, 17 Jul 2019 08:19:45 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B1964204B; Wed, 17 Jul 2019 08:19:44 +0000 (GMT) Received: from lep8c.aus.stglabs.ibm.com (unknown [9.40.192.207]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 17 Jul 2019 08:19:44 +0000 (GMT) From: Shivaprasad G Bhat To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Date: Wed, 17 Jul 2019 03:19:43 -0500 In-Reply-To: <156335150620.82682.9535735857478533420.stgit@lep8c.aus.stglabs.ibm.com> References: <156335150620.82682.9535735857478533420.stgit@lep8c.aus.stglabs.ibm.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19071708-0012-0000-0000-00000333A40D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071708-0013-0000-0000-0000216D212E Message-Id: <156335156198.82682.8756968724044750843.stgit@lep8c.aus.stglabs.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-17_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907170099 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v2 1/4] ppc: fix memory leak in spapr_caps_add_properties X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Free the capability name string after setting the capability. Signed-off-by: Shivaprasad G Bhat Reviewed-by: Greg Kurz --- hw/ppc/spapr_caps.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index bbb001f84a..0263c78d69 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -778,7 +778,7 @@ void spapr_caps_add_properties(SpaprMachineClass *smc, = Error **errp) =20 for (i =3D 0; i < ARRAY_SIZE(capability_table); i++) { SpaprCapabilityInfo *cap =3D &capability_table[i]; - const char *name =3D g_strdup_printf("cap-%s", cap->name); + char *name =3D g_strdup_printf("cap-%s", cap->name); char *desc; =20 object_class_property_add(klass, name, cap->type, @@ -786,11 +786,13 @@ void spapr_caps_add_properties(SpaprMachineClass *smc= , Error **errp) NULL, cap, &local_err); if (local_err) { error_propagate(errp, local_err); + g_free(name); return; } =20 desc =3D g_strdup_printf("%s", cap->description); object_class_property_set_description(klass, name, desc, &local_er= r); + g_free(name); g_free(desc); if (local_err) { error_propagate(errp, local_err); From nobody Mon May 13 03:49:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1563351624; cv=none; d=zoho.com; s=zohoarc; b=kNB8ROhWSYs2HXT098D5OVvZ0chRG57QTw8+yGROe9TN5DwyBPB93sAl6jfsupvlDPR/r/1PJtr3IFAvttJzkfFhZAR9KGj08Vxr//1Z+vma218Krk3aFIgKTHnDFl/6/gEUpAK0+sS9/HOl6EAapI3MIYFrY52X6T2O/SwpPPU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563351624; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=N0c/TvTw/knwiPN3Bh4sIs6qkQ+ituBHRMd3LGr3llc=; b=PTFjBUAg3P0LoPBUU1T/uFutBCayiXBOZoG/TpG37YUMFGSTpZmbMhxQ4k0MPOf+ajG2lAq/fEy/DZHFl08Oa9n1ov6oYu0HvMVHeFutu8OosLSAWozG5rAKDL+vEWMFQQGG2RFNodj4L9OQ6dKm6pOAsPVsm6/vxstM/07SnXU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156335162493296.84603106340376; Wed, 17 Jul 2019 01:20:24 -0700 (PDT) Received: from localhost ([::1]:54928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hnfAl-0002pD-V0 for importer@patchew.org; Wed, 17 Jul 2019 04:20:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42584) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hnfAX-000263-Ao for qemu-devel@nongnu.org; Wed, 17 Jul 2019 04:20:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hnfAW-0003Cd-AP for qemu-devel@nongnu.org; Wed, 17 Jul 2019 04:20:09 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:3480 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hnfAW-0003CJ-2h for qemu-devel@nongnu.org; Wed, 17 Jul 2019 04:20:08 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6H8JBdV021094 for ; Wed, 17 Jul 2019 04:20:07 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2tswb5fn5m-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 17 Jul 2019 04:20:07 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 17 Jul 2019 09:20:05 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 17 Jul 2019 09:20:03 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6H8K2W654067394 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Jul 2019 08:20:02 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7877511C058; Wed, 17 Jul 2019 08:20:02 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EB77D11C06C; Wed, 17 Jul 2019 08:20:01 +0000 (GMT) Received: from lep8c.aus.stglabs.ibm.com (unknown [9.40.192.207]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 17 Jul 2019 08:20:01 +0000 (GMT) From: Shivaprasad G Bhat To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Date: Wed, 17 Jul 2019 03:20:01 -0500 In-Reply-To: <156335150620.82682.9535735857478533420.stgit@lep8c.aus.stglabs.ibm.com> References: <156335150620.82682.9535735857478533420.stgit@lep8c.aus.stglabs.ibm.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19071708-4275-0000-0000-0000034E0516 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071708-4276-0000-0000-0000385E19A4 Message-Id: <156335159028.82682.5404622104535818162.stgit@lep8c.aus.stglabs.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-17_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907170099 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v2 2/4] ppc: fix memory leak in spapr_dt_drc() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Leaking the drc_name while preparing the DT properties. Fixing that. Also, remove the const qualifier from spapr_drc_name(). Signed-off-by: Shivaprasad G Bhat Reviewed-by: Greg Kurz --- hw/ppc/spapr_drc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index bacadfcac5..695a0b2285 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -226,7 +226,7 @@ static uint32_t drc_set_unusable(SpaprDrc *drc) return RTAS_OUT_SUCCESS; } =20 -static const char *spapr_drc_name(SpaprDrc *drc) +static char *spapr_drc_name(SpaprDrc *drc) { SpaprDrcClass *drck =3D SPAPR_DR_CONNECTOR_GET_CLASS(drc); =20 @@ -827,6 +827,7 @@ int spapr_dt_drc(void *fdt, int offset, Object *owner, = uint32_t drc_type_mask) Object *obj; SpaprDrc *drc; SpaprDrcClass *drck; + char *drc_name =3D NULL; uint32_t drc_index, drc_power_domain; =20 if (!strstart(prop->type, "link<", NULL)) { @@ -856,8 +857,10 @@ int spapr_dt_drc(void *fdt, int offset, Object *owner,= uint32_t drc_type_mask) g_array_append_val(drc_power_domains, drc_power_domain); =20 /* ibm,drc-names */ - drc_names =3D g_string_append(drc_names, spapr_drc_name(drc)); + drc_name =3D spapr_drc_name(drc); + drc_names =3D g_string_append(drc_names, drc_name); drc_names =3D g_string_insert_len(drc_names, -1, "\0", 1); + g_free(drc_name); =20 /* ibm,drc-types */ drc_types =3D g_string_append(drc_types, drck->typename); From nobody Mon May 13 03:49:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1563351654; cv=none; d=zoho.com; s=zohoarc; b=jChFllCEW/051A+9ptyPfe1rJ7jn7MdDYywBfqOv0ey4nsa/N1QSiLcIaAvTOE8LWjfBucqzU56O33QELIpZMOJyMJUELgdR1xyfjikSjLI8yHS+IqoAJnOiIG+GxqD5oxaJuSBrD1ZY0TROSvja9u8jmn6WZN1NONmHiQRHP4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563351654; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=sklRoWUpaL794COuuuHMRB7Yw0UZJ+sDlsndfCA2r5Y=; b=Fytid+wiU+ceOamR5kKS65xXLmB/qs03herFRp7Bm9w3jC4+EnPjhE/PfBzakupbEX3uB3s+NDBZpu36CXCJENkHQoZmPc7xFzaZsX5m25rDG8DehbfIxqeh2MTxzFEB8v8wmTpmRZEuuZ1R0tdcnnUT4ZNsewRv9ZV4fCNnVK0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563351654090311.19076502982955; Wed, 17 Jul 2019 01:20:54 -0700 (PDT) Received: from localhost ([::1]:54942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hnfBF-0003vy-3A for importer@patchew.org; Wed, 17 Jul 2019 04:20:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42835) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hnfB3-0003My-Kq for qemu-devel@nongnu.org; Wed, 17 Jul 2019 04:20:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hnfB2-0003kN-Hm for qemu-devel@nongnu.org; Wed, 17 Jul 2019 04:20:41 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57878) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hnfB2-0003hm-6C for qemu-devel@nongnu.org; Wed, 17 Jul 2019 04:20:40 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6H8IEV4106049 for ; Wed, 17 Jul 2019 04:20:39 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tsyrr8kpt-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 17 Jul 2019 04:20:38 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 17 Jul 2019 09:20:36 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 17 Jul 2019 09:20:34 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6H8KJYr40567106 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Jul 2019 08:20:19 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0E2C4A405C; Wed, 17 Jul 2019 08:20:33 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 80511A405B; Wed, 17 Jul 2019 08:20:32 +0000 (GMT) Received: from lep8c.aus.stglabs.ibm.com (unknown [9.40.192.207]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 17 Jul 2019 08:20:32 +0000 (GMT) From: Shivaprasad G Bhat To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Date: Wed, 17 Jul 2019 03:20:31 -0500 In-Reply-To: <156335150620.82682.9535735857478533420.stgit@lep8c.aus.stglabs.ibm.com> References: <156335150620.82682.9535735857478533420.stgit@lep8c.aus.stglabs.ibm.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19071708-0020-0000-0000-000003549E6A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071708-0021-0000-0000-000021A86F0E Message-Id: <156335160761.82682.11912058325777251614.stgit@lep8c.aus.stglabs.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-17_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907170099 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v2 3/4] ppc: fix leak in h_client_architecture_support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Free all SpaprOptionVector local pointers after use. Signed-off-by: Shivaprasad G Bhat Reviewed-by: Greg Kurz --- hw/ppc/spapr_hcall.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 6808d4cda8..71cfe7c41d 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1612,6 +1612,7 @@ static target_ulong h_client_architecture_support(Pow= erPCCPU *cpu, ov5_updates =3D spapr_ovec_new(); spapr->cas_reboot =3D spapr_ovec_diff(ov5_updates, ov5_cas_old, spapr->ov5_cas); + spapr_ovec_cleanup(ov5_cas_old); /* Now that processing is finished, set the radix/hash bit for the * guest if it requested a valid mode; otherwise terminate the boot. */ if (guest_radix) { @@ -1629,6 +1630,7 @@ static target_ulong h_client_architecture_support(Pow= erPCCPU *cpu, } spapr->cas_legacy_guest_workaround =3D !spapr_ovec_test(ov1_guest, OV1_PPC_3_00); + spapr_ovec_cleanup(ov1_guest); if (!spapr->cas_reboot) { /* If spapr_machine_reset() did not set up a HPT but one is necess= ary * (because the guest isn't going to use radix) then set it up her= e. */ From nobody Mon May 13 03:49:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1563351682; cv=none; d=zoho.com; s=zohoarc; b=mGMoP+F59H/RlZ90yusHGjHHo3QwJ6HgrOy6MM3siUmLY6Cj5fPAV8lp/bsoNfUG65T/00xedxi0uCGdczh/5tQajFBjlQRMt1v7IeBrdLMb9hVd6Zv8BimlEb0opjG5gddGAXYLesk+UAAcarruxdOUcW0jqliCS267OP398zo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563351682; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=pN2kwX7Zyi3i+R6+QizYY+S31ItD2v4EBR2ax/isNeM=; b=Ecg65fVoSyP7g6jzMe4wRDl1QaltcuucFCrZ6JnE1lACyQcBWrFE9pMZgbHNb/hODeBfTD63tXONcOFtdGkKGtzNz/qauLgq6o2PPEYJ8sSi/D2XLGRmyW2aysrcXjbqtDsw6PueS/nlwFPVnT+WPvHUCfJEMzeJtbxsEzJ9y9I= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563351682516403.0942492491006; Wed, 17 Jul 2019 01:21:22 -0700 (PDT) Received: from localhost ([::1]:54954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hnfBh-0004yr-Jk for importer@patchew.org; Wed, 17 Jul 2019 04:21:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43002) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hnfBW-0004S1-1G for qemu-devel@nongnu.org; Wed, 17 Jul 2019 04:21:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hnfBU-0004Ge-0M for qemu-devel@nongnu.org; Wed, 17 Jul 2019 04:21:09 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:53744) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hnfBR-0004Dg-TE for qemu-devel@nongnu.org; Wed, 17 Jul 2019 04:21:07 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6H8HXem022312 for ; Wed, 17 Jul 2019 04:21:03 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tswpvegxe-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 17 Jul 2019 04:21:03 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 17 Jul 2019 09:21:00 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 17 Jul 2019 09:20:57 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6H8KuGt32243918 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Jul 2019 08:20:56 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 771465204F; Wed, 17 Jul 2019 08:20:56 +0000 (GMT) Received: from lep8c.aus.stglabs.ibm.com (unknown [9.40.192.207]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id EAC7C52059; Wed, 17 Jul 2019 08:20:55 +0000 (GMT) From: Shivaprasad G Bhat To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Date: Wed, 17 Jul 2019 03:20:55 -0500 In-Reply-To: <156335150620.82682.9535735857478533420.stgit@lep8c.aus.stglabs.ibm.com> References: <156335150620.82682.9535735857478533420.stgit@lep8c.aus.stglabs.ibm.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19071708-0020-0000-0000-000003549E70 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071708-0021-0000-0000-000021A86F17 Message-Id: <156335163818.82682.7196904841379833409.stgit@lep8c.aus.stglabs.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-17_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=789 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907170099 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v2 4/4] ppc: dont overwrite initialized idle_timer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The check to see if the idle_timer is already initialized is missing. Every vcpu thread would call kvm_arch_init_vcpu() and overwrite the idle_timer resulting in a memory leak. Patch fixes that. Signed-off-by: Shivaprasad G Bhat --- target/ppc/kvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 8a06d3171e..498ca6d53b 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -491,7 +491,8 @@ int kvm_arch_init_vcpu(CPUState *cs) return ret; } =20 - idle_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, kvm_kick_cpu, cpu); + if (!idle_timer) + idle_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, kvm_kick_cpu, cpu); =20 switch (cenv->mmu_model) { case POWERPC_MMU_BOOKE206: