From: Cornelia Huck <cohuck@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
Alexander Graf <agraf@suse.de>,
Richard Henderson <rth@twiddle.net>,
David Hildenbrand <david@redhat.com>,
Thomas Huth <thuth@redhat.com>,
qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
Greg Kurz <groug@kaod.org>, Cornelia Huck <cohuck@redhat.com>
Subject: [Qemu-devel] [PULL for-2.12 1/3] hw/s390x: fix memory leak in s390_init_ipl_dev()
Date: Tue, 3 Apr 2018 10:36:23 +0200 [thread overview]
Message-ID: <20180403083625.15297-2-cohuck@redhat.com> (raw)
In-Reply-To: <20180403083625.15297-1-cohuck@redhat.com>
From: Greg Kurz <groug@kaod.org>
The string returned by object_property_get_str() is dynamically allocated.
Fixes: 3c4e9baacf4d9
Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <152231460685.69730.14860451936216690693.stgit@bahia.lan>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
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 864145a7c6..435f7c99e7 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);
--
2.14.3
next prev parent reply other threads:[~2018-04-03 8:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-03 8:36 [Qemu-devel] [PULL for-2.12 0/3] s390x fixes for -rc2 Cornelia Huck
2018-04-03 8:36 ` Cornelia Huck [this message]
2018-04-03 8:36 ` [Qemu-devel] [PULL for-2.12 2/3] pc-bios/s390-ccw: Increase virtio timeout to 30 seconds Cornelia Huck
2018-04-03 8:36 ` [Qemu-devel] [PULL for-2.12 3/3] pc-bios/s390-ccw: update image Cornelia Huck
2018-04-04 8:35 ` [Qemu-devel] [PULL for-2.12 0/3] s390x fixes for -rc2 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180403083625.15297-2-cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=david@redhat.com \
--cc=groug@kaod.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rth@twiddle.net \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).