qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] file-posix: Don't leak fd in hdev_get_max_segme


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] file-posix: Don't leak fd in hdev_get_max_segments
Date: Tue, 14 Mar 2017 11:16:34 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 03/14/2017 11:14 AM, Eric Blake wrote:
> On 03/14/2017 11:11 AM, Eric Blake wrote:
>> On 03/14/2017 10:43 AM, Fam Zheng wrote:
>>> Signed-off-by: Fam Zheng <address@hidden>
>>> ---
>>>  block/file-posix.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/block/file-posix.c b/block/file-posix.c
>>> index c4c0663..e6170f4 100644
>>> --- a/block/file-posix.c
>>> +++ b/block/file-posix.c
>>> @@ -703,6 +703,7 @@ static int hdev_get_max_segments(const struct stat *st)
>>
>> hdev_get_max_segments() is not part of master yet; should this just be
>> treated as a fixup! to a pending patch?
> 
> Scratch that - I forgot to 'git pull' on my end.
> 
> Commit message could usefully be improved by mentioning commit 9103f1ce
> as the spot the problem was introduced.
> 
> Reviewed-by: Eric Blake <address@hidden>
> 

Question: does valgrind or any other tool complain about:

+    if (fd == -1) {
+        ret = -errno;
+        goto out;
+    }
...
+out:
+    close(fd);
+    g_free(sysfspath);
+    return ret;

this being a useless syscall to close(-1) ?  If so, you need to wrap in
an 'if (fd != -1)'

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]