[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [qemu-s390x] [PATCH 3/3] sev/i386: fix memory leak in sev_guest_init
From: |
Thomas Huth |
Subject: |
Re: [qemu-s390x] [PATCH 3/3] sev/i386: fix memory leak in sev_guest_init() |
Date: |
Thu, 29 Mar 2018 13:56:26 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 29.03.2018 11:24, Cornelia Huck wrote:
> On Thu, 29 Mar 2018 11:10:21 +0200
> Greg Kurz <address@hidden> wrote:
>
>> The string returned by object_property_get_str() is dynamically allocated.
>>
>> Fixes: d8575c6c0242b
>> Signed-off-by: Greg Kurz <address@hidden>
>> ---
>> 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 <address@hidden>
- Re: [qemu-s390x] [Qemu-devel] [PATCH 2/3] hw/s390x: fix memory leak in s390_init_ipl_dev(), (continued)
Re: [qemu-s390x] [PATCH 2/3] hw/s390x: fix memory leak in s390_init_ipl_dev(), Thomas Huth, 2018/03/29
Re: [qemu-s390x] [PATCH 2/3] hw/s390x: fix memory leak in s390_init_ipl_dev(), Cornelia Huck, 2018/03/29
[qemu-s390x] [PATCH 3/3] sev/i386: fix memory leak in sev_guest_init(), Greg Kurz, 2018/03/29
Re: [qemu-s390x] [Qemu-devel] [PATCH 0/3] fix memory leaks when using object_property_get_str(), no-reply, 2018/03/31