All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Cornelia Huck <cohuck@redhat.com>, Greg Kurz <groug@kaod.org>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
	David Hildenbrand <david@redhat.com>,
	qemu-stable@nongnu.org,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>,
	Alexander Graf <agraf@suse.de>,
	qemu-devel@nongnu.org, qemu-s390x@nongnu.org,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [qemu-s390x] [PATCH 3/3] sev/i386: fix memory leak in sev_guest_init()
Date: Thu, 29 Mar 2018 13:56:26 +0200	[thread overview]
Message-ID: <d5c2a929-737c-aa25-b531-8a8570468e0d@redhat.com> (raw)
In-Reply-To: <20180329112416.28b99184.cohuck@redhat.com>

On 29.03.2018 11:24, Cornelia Huck wrote:
> On Thu, 29 Mar 2018 11:10:21 +0200
> Greg Kurz <groug@kaod.org> wrote:
> 
>> 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);
>>
> 
> I would probably add an extra g_free(devname) right before the goto
> err, but this works as well, obviously.

Or maybe remove devname from the error_report ("%s: Failed to open
sev-device '%s', __func__ strerror(errno)) and move the g_free right
before the if-statement?

Anyway:

Reviewed-by: Thomas Huth <thuth@redhat.com>

  parent reply	other threads:[~2018-03-29 11:56 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 ` [Qemu-devel] [PATCH 3/3] sev/i386: fix memory leak in sev_guest_init() Greg Kurz
2018-03-29  9:24   ` Cornelia Huck
2018-03-29 10:27     ` Greg Kurz
2018-03-29 11:56     ` Thomas Huth [this message]
2018-04-03  2:07   ` 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=d5c2a929-737c-aa25-b531-8a8570468e0d@redhat.com \
    --to=thuth@redhat.com \
    --cc=agraf@suse.de \
    --cc=cohuck@redhat.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=david@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=groug@kaod.org \
    --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.