From patchwork Thu Mar 29 09:09:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 892646 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Bf9w6wYQz9s0q for ; Thu, 29 Mar 2018 20:11:00 +1100 (AEDT) Received: from localhost ([::1]:60664 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1TaE-0001p4-Fo for incoming@patchwork.ozlabs.org; Thu, 29 Mar 2018 05:10:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1TZQ-0001kw-89 for qemu-devel@nongnu.org; Thu, 29 Mar 2018 05:10:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f1TZM-0005x9-0f for qemu-devel@nongnu.org; Thu, 29 Mar 2018 05:10:07 -0400 Received: from 6.mo6.mail-out.ovh.net ([87.98.177.69]:54255) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f1TZL-0005vm-Qm for qemu-devel@nongnu.org; Thu, 29 Mar 2018 05:10:03 -0400 Received: from player728.ha.ovh.net (unknown [10.109.105.27]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 2455014E5CE for ; Thu, 29 Mar 2018 11:10:01 +0200 (CEST) Received: from bahia.lan (lns-bzn-46-82-253-208-248.adsl.proxad.net [82.253.208.248]) (Authenticated sender: groug@kaod.org) by player728.ha.ovh.net (Postfix) with ESMTPA id 817995400A4; Thu, 29 Mar 2018 11:09:52 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Thu, 29 Mar 2018 11:09:46 +0200 Message-ID: <152231458624.69730.1752893648612848392.stgit@bahia.lan> In-Reply-To: <152231456507.69730.15601462044394150786.stgit@bahia.lan> References: <152231456507.69730.15601462044394150786.stgit@bahia.lan> User-Agent: StGit/0.17.1-46-g6855-dirty MIME-Version: 1.0 X-Ovh-Tracer-Id: 12495518642410068310 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtgedrfedvgddutdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 87.98.177.69 Subject: [Qemu-devel] [PATCH 1/3] exec: fix memory leak in find_max_supported_pagesize() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Crosthwaite , Eduardo Habkost , David Hildenbrand , Cornelia Huck , Alexander Graf , qemu-stable@nongnu.org, qemu-s390x@nongnu.org, Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The string returned by object_property_get_str() is dynamically allocated. Signed-off-by: Greg Kurz Reviewed-by: Cornelia Huck Reviewed-by: Thomas Huth --- exec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/exec.c b/exec.c index c09bd93df31e..02b1efebb7c3 100644 --- a/exec.c +++ b/exec.c @@ -1495,6 +1495,7 @@ static int find_max_supported_pagesize(Object *obj, void *opaque) mem_path = object_property_get_str(obj, "mem-path", NULL); if (mem_path) { long hpsize = qemu_mempath_getpagesize(mem_path); + g_free(mem_path); if (hpsize < *hpsize_min) { *hpsize_min = hpsize; } From patchwork Thu Mar 29 09:10:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 892647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40BfB94C4pz9s0t for ; Thu, 29 Mar 2018 20:11:13 +1100 (AEDT) Received: from localhost ([::1]:60681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1TaQ-000241-D9 for incoming@patchwork.ozlabs.org; Thu, 29 Mar 2018 05:11:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1TZe-0001zS-Vi for qemu-devel@nongnu.org; Thu, 29 Mar 2018 05:10:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f1TZa-000697-9G for qemu-devel@nongnu.org; Thu, 29 Mar 2018 05:10:22 -0400 Received: from 6.mo177.mail-out.ovh.net ([46.105.51.249]:39561) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f1TZZ-00066k-Qe for qemu-devel@nongnu.org; Thu, 29 Mar 2018 05:10:18 -0400 Received: from player729.ha.ovh.net (unknown [10.109.122.92]) by mo177.mail-out.ovh.net (Postfix) with ESMTP id 4D4CFA6C4F for ; Thu, 29 Mar 2018 11:10:16 +0200 (CEST) Received: from bahia.lan (lns-bzn-46-82-253-208-248.adsl.proxad.net [82.253.208.248]) (Authenticated sender: groug@kaod.org) by player729.ha.ovh.net (Postfix) with ESMTPA id EB5225E00A2; Thu, 29 Mar 2018 11:10:06 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Thu, 29 Mar 2018 11:10:06 +0200 Message-ID: <152231460685.69730.14860451936216690693.stgit@bahia.lan> In-Reply-To: <152231456507.69730.15601462044394150786.stgit@bahia.lan> References: <152231456507.69730.15601462044394150786.stgit@bahia.lan> User-Agent: StGit/0.17.1-46-g6855-dirty MIME-Version: 1.0 X-Ovh-Tracer-Id: 12499740768765319510 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtgedrfedvgdduudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.51.249 Subject: [Qemu-devel] [PATCH 2/3] hw/s390x: fix memory leak in s390_init_ipl_dev() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Crosthwaite , Eduardo Habkost , David Hildenbrand , Cornelia Huck , Alexander Graf , qemu-stable@nongnu.org, qemu-s390x@nongnu.org, Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The string returned by object_property_get_str() is dynamically allocated. Fixes: 3c4e9baacf4d9 Signed-off-by: Greg Kurz Reviewed-by: Thomas Huth --- hw/s390x/s390-virtio-ccw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 864145a7c6f3..435f7c99e77c 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -246,6 +246,7 @@ static void s390_init_ipl_dev(const char *kernel_filename, { Object *new = object_new(TYPE_S390_IPL); DeviceState *dev = DEVICE(new); + char *netboot_fw_prop; if (kernel_filename) { qdev_prop_set_string(dev, "kernel", kernel_filename); @@ -256,9 +257,11 @@ static void s390_init_ipl_dev(const char *kernel_filename, qdev_prop_set_string(dev, "cmdline", kernel_cmdline); qdev_prop_set_string(dev, "firmware", firmware); qdev_prop_set_bit(dev, "enforce_bios", enforce_bios); - if (!strlen(object_property_get_str(new, "netboot_fw", &error_abort))) { + netboot_fw_prop = object_property_get_str(new, "netboot_fw", &error_abort); + if (!strlen(netboot_fw_prop)) { qdev_prop_set_string(dev, "netboot_fw", netboot_fw); } + g_free(netboot_fw_prop); object_property_add_child(qdev_get_machine(), TYPE_S390_IPL, new, NULL); object_unref(new); From patchwork Thu Mar 29 09:10:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 892649 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40BfDq5nmRz9s0q for ; Thu, 29 Mar 2018 20:13:31 +1100 (AEDT) Received: from localhost ([::1]:60866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1Tcf-0004Ic-CN for incoming@patchwork.ozlabs.org; Thu, 29 Mar 2018 05:13:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f1TZs-0002Bo-Hw for qemu-devel@nongnu.org; Thu, 29 Mar 2018 05:10:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f1TZo-0006HA-H7 for qemu-devel@nongnu.org; Thu, 29 Mar 2018 05:10:36 -0400 Received: from 6.mo5.mail-out.ovh.net ([178.32.119.138]:49961) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f1TZo-0006Gr-BS for qemu-devel@nongnu.org; Thu, 29 Mar 2018 05:10:32 -0400 Received: from player728.ha.ovh.net (unknown [10.109.120.119]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id AFBB119A308 for ; Thu, 29 Mar 2018 11:10:30 +0200 (CEST) Received: from bahia.lan (lns-bzn-46-82-253-208-248.adsl.proxad.net [82.253.208.248]) (Authenticated sender: groug@kaod.org) by player728.ha.ovh.net (Postfix) with ESMTPA id 4245754008F; Thu, 29 Mar 2018 11:10:21 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Thu, 29 Mar 2018 11:10:21 +0200 Message-ID: <152231462116.69730.14119625999092384450.stgit@bahia.lan> In-Reply-To: <152231456507.69730.15601462044394150786.stgit@bahia.lan> References: <152231456507.69730.15601462044394150786.stgit@bahia.lan> User-Agent: StGit/0.17.1-46-g6855-dirty MIME-Version: 1.0 X-Ovh-Tracer-Id: 12503681418255636822 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtgedrfedvgdduudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.32.119.138 Subject: [Qemu-devel] [PATCH 3/3] sev/i386: fix memory leak in sev_guest_init() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Crosthwaite , Eduardo Habkost , David Hildenbrand , Cornelia Huck , Alexander Graf , qemu-stable@nongnu.org, qemu-s390x@nongnu.org, Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The string returned by object_property_get_str() is dynamically allocated. Fixes: d8575c6c0242b Signed-off-by: Greg Kurz Reviewed-by: Cornelia Huck Reviewed-by: Thomas Huth --- target/i386/sev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 019d84cef2c7..c01167143f1c 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -748,9 +748,11 @@ sev_guest_init(const char *id) if (s->sev_fd < 0) { error_report("%s: Failed to open %s '%s'", __func__, devname, strerror(errno)); - goto err; } g_free(devname); + if (s->sev_fd < 0) { + goto err; + } ret = sev_platform_ioctl(s->sev_fd, SEV_PLATFORM_STATUS, &status, &fw_error);