All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shannon Zhao <zhaoshenglong@huawei.com>
To: Stefan Weil <sw@weilnetz.de>, <qemu-devel@nongnu.org>
Cc: peter.maydell@linaro.org, hangaohuai@huawei.com,
	zhang.zhanghailiang@huawei.com, qemu-trivial@nongnu.org,
	mjt@tls.msk.ru, peter.huangpeng@huawei.com,
	shannon.zhao@linaro.org, pbonzini@redhat.com
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] qga/commands-posix: Fix resource leak
Date: Sat, 14 Mar 2015 17:14:31 +0800	[thread overview]
Message-ID: <5503FBF7.3090404@huawei.com> (raw)
In-Reply-To: <5503DB1F.8080305@weilnetz.de>

On 2015/3/14 14:54, Stefan Weil wrote:
> Am 14.03.2015 um 04:30 schrieb Shannon Zhao:
>> It's detected by coverity. Close the dirfd.
>>
>> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
>> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>> ---
>>   qga/commands-posix.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
>> index d5bb5cb..cbf1c80 100644
>> --- a/qga/commands-posix.c
>> +++ b/qga/commands-posix.c
>> @@ -2285,6 +2285,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
>>       ga_read_sysfs_file(dirfd, "block_size_bytes", buf, 20, &local_err);
> 
> Why not closing it here? It's no longer needed.
> 

Ok, will fix this.

Thanks,
Shannon
>>       if (local_err) {
>>           g_free(buf);
>> +        close(dirfd);
>>           error_propagate(errp, local_err);
>>           return NULL;
>>       }
>> @@ -2293,6 +2294,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
>>       info->size = strtol(buf, NULL, 16); /* the unit is bytes */
>>         g_free(buf);
>> +    close(dirfd);
>>         return info;
>>   }
> 
> 
> .
> 



WARNING: multiple messages have this Message-ID (diff)
From: Shannon Zhao <zhaoshenglong@huawei.com>
To: Stefan Weil <sw@weilnetz.de>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, hangaohuai@huawei.com,
	zhang.zhanghailiang@huawei.com, qemu-trivial@nongnu.org,
	mjt@tls.msk.ru, mdroth@linux.vnet.ibm.com,
	peter.huangpeng@huawei.com, shannon.zhao@linaro.org,
	pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH] qga/commands-posix: Fix resource leak
Date: Sat, 14 Mar 2015 17:14:31 +0800	[thread overview]
Message-ID: <5503FBF7.3090404@huawei.com> (raw)
In-Reply-To: <5503DB1F.8080305@weilnetz.de>

On 2015/3/14 14:54, Stefan Weil wrote:
> Am 14.03.2015 um 04:30 schrieb Shannon Zhao:
>> It's detected by coverity. Close the dirfd.
>>
>> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
>> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>> ---
>>   qga/commands-posix.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
>> index d5bb5cb..cbf1c80 100644
>> --- a/qga/commands-posix.c
>> +++ b/qga/commands-posix.c
>> @@ -2285,6 +2285,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
>>       ga_read_sysfs_file(dirfd, "block_size_bytes", buf, 20, &local_err);
> 
> Why not closing it here? It's no longer needed.
> 

Ok, will fix this.

Thanks,
Shannon
>>       if (local_err) {
>>           g_free(buf);
>> +        close(dirfd);
>>           error_propagate(errp, local_err);
>>           return NULL;
>>       }
>> @@ -2293,6 +2294,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
>>       info->size = strtol(buf, NULL, 16); /* the unit is bytes */
>>         g_free(buf);
>> +    close(dirfd);
>>         return info;
>>   }
> 
> 
> .
> 

  reply	other threads:[~2015-03-14  9:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-14  3:30 [Qemu-trivial] [PATCH] qga/commands-posix: Fix resource leak Shannon Zhao
2015-03-14  3:30 ` [Qemu-devel] " Shannon Zhao
2015-03-14  6:54 ` [Qemu-trivial] " Stefan Weil
2015-03-14  6:54   ` Stefan Weil
2015-03-14  9:14   ` Shannon Zhao [this message]
2015-03-14  9:14     ` Shannon Zhao

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=5503FBF7.3090404@huawei.com \
    --to=zhaoshenglong@huawei.com \
    --cc=hangaohuai@huawei.com \
    --cc=mjt@tls.msk.ru \
    --cc=pbonzini@redhat.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=shannon.zhao@linaro.org \
    --cc=sw@weilnetz.de \
    --cc=zhang.zhanghailiang@huawei.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 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.