[libvirt] [PATCH] rpc: virNetClientNew: fix socket leak on error path
Nikolay Shirokovskiy
nshirokovskiy at virtuozzo.com
Fri Jan 18 11:02:29 UTC 2019
On 18.01.2019 13:32, Daniel P. Berrangé wrote:
> On Fri, Jan 18, 2019 at 11:38:39AM +0300, Nikolay Shirokovskiy wrote:
>> if virNetClientNew finishes with error before sock is set
>> to client object then sock does not get unrefed. This is
>> unexpected by function clients like virNetClientNewUNIX.
>> Let's make sure sock gets unrefed on any error path.
>>
>> Next some clients like virNetClientNewLibSSH2 try to unref
>> sock on virNetClientNew errors. This is not correct even
>> before this patch because in some cases virNetClientNew
>> unrefed sock on error path by itself. Let's give up
>> sock managment to virNetClientNew entirely.
>>
>> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
>> ---
>> src/rpc/virnetclient.c | 8 +++-----
>> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>
>
Thanks! Pushed.
Nikolay
More information about the libvir-list
mailing list