All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>,
	Richard Henderson <rth@twiddle.net>,
	Cornelia Huck <cohuck@redhat.com>, Alexander Graf <agraf@suse.de>,
	David Hildenbrand <david@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	qemu-s390x@nongnu.org, qemu-stable@nongnu.org
Subject: [Qemu-devel] [PATCH 3/3] sev/i386: fix memory leak in sev_guest_init()
Date: Thu, 29 Mar 2018 11:10:21 +0200	[thread overview]
Message-ID: <152231462116.69730.14119625999092384450.stgit@bahia.lan> (raw)
In-Reply-To: <152231456507.69730.15601462044394150786.stgit@bahia.lan>

The string returned by object_property_get_str() is dynamically allocated.

Fixes: d8575c6c0242b
Signed-off-by: Greg Kurz <groug@kaod.org>
---
 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);

  parent reply	other threads:[~2018-03-29  9:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-29  9:09 [Qemu-devel] [PATCH 0/3] fix memory leaks when using object_property_get_str() Greg Kurz
2018-03-29  9:09 ` [Qemu-devel] [PATCH 1/3] exec: fix memory leak in find_max_supported_pagesize() Greg Kurz
2018-03-29  9:18   ` Cornelia Huck
2018-03-29  9:44     ` Greg Kurz
2018-03-29 11:47   ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-04-03  2:06   ` [Qemu-devel] " Eduardo Habkost
2018-03-29  9:10 ` [Qemu-devel] [PATCH 2/3] hw/s390x: fix memory leak in s390_init_ipl_dev() Greg Kurz
2018-03-29  9:20   ` Cornelia Huck
2018-03-29  9:27   ` Igor Mammedov
2018-03-29  9:28     ` Cornelia Huck
2018-03-29  9:39     ` Greg Kurz
2018-03-29 10:31       ` Cornelia Huck
2018-03-29 11:49         ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-03-29 11:50   ` Thomas Huth
2018-03-29 12:09   ` [Qemu-devel] " Cornelia Huck
2018-03-29  9:10 ` Greg Kurz [this message]
2018-03-29  9:24   ` [Qemu-devel] [PATCH 3/3] sev/i386: fix memory leak in sev_guest_init() Cornelia Huck
2018-03-29 10:27     ` Greg Kurz
2018-03-29 11:56     ` [Qemu-devel] [qemu-s390x] " Thomas Huth
2018-04-03  2:07   ` [Qemu-devel] " Eduardo Habkost
2018-03-31  6:39 ` [Qemu-devel] [PATCH 0/3] fix memory leaks when using object_property_get_str() no-reply

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=152231462116.69730.14119625999092384450.stgit@bahia.lan \
    --to=groug@kaod.org \
    --cc=agraf@suse.de \
    --cc=cohuck@redhat.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=david@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=rth@twiddle.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.