Hi Greg,

Thanks for your review.

On 2020/11/26 20:07, Greg Kurz wrote:
> On Thu, 26 Nov 2020 10:16:24 +0000
> Alex Chen <alex.c...@huawei.com> wrote:
> 
>> Only one of the options -s and -f can be used. When -f is used,
>> the fd is created externally and does not need to be closed.
> 
> The process running virtfs-proxy-helper has its own copy of
> the fd inherited from its parent. And this fd will be closed
> eventually when the process terminates.
> 
>> When -s is used, a new socket fd is created, and this socket fd
>> needs to be closed at the end of main().
>>
> 
> Same here, the new socket fd is closed when the process
> terminates.

IMO, it's best to explicitly release resources before the process terminates,
just as the variable 'rpath' is explicitly freed in main(),
so socket fd also needs to be explicitly closed here.

Looking forward to your reply.

> 
> The only justification to merge such a change would be if
> the code was sitting in some other function, in which
> case we should indeed do proper rollback. But it is main()
> here, so this patch isn't needed.
> 
>> Reported-by: Euler Robot <euler.ro...@huawei.com>
> 
> Can you provide a copy of the report in case I'm
> missing something ?
> 

Our codecheck tool reports a resource leak here, which is relatively simple,
like the one below, I did not attach it.

---------------------
"Resource leak: sock"
---------------------

Thanks,
Alex


Reply via email to