In function tcp_chr_close, the s->sioc needs call object_unref() to be released 
? 

About the below code:

@@ -3205,10 +3205,13 @@ static void tcp_chr_close(CharDriverState *chr)
         s->listen_tag = 0;
     }
     if (s->listen_ioc) {
         object_unref(OBJECT(s->listen_ioc));
     }
+    if (s->sioc) {
+        object_unref(OBJECT(s->sioc));
+    }
     if (s->read_msgfds_num) {
         for (i = 0; i < s->read_msgfds_num; i++) {
             close(s->read_msgfds[i]);
         }
         g_free(s->read_msgfds);

Thanks

Yunjian

-----Original Message-----
From: Paolo Bonzini [mailto:pbonz...@redhat.com] 
Sent: Monday, October 17, 2016 9:20 PM
To: wangyunjian
Cc: berra...@redhat.com; qemu-devel@nongnu.org; caihe
Subject: Re: A question about this commit "char: convert from GIOChannel to 
QIOChannel"



----- Original Message -----
> From: "wangyunjian" <wangyunj...@huawei.com>
> To: berra...@redhat.com, pbonz...@redhat.com, qemu-devel@nongnu.org
> Cc: "caihe" <ca...@huawei.com>
> Sent: Monday, October 17, 2016 3:02:32 PM
> Subject: A question about this commit "char: convert from GIOChannel to 
> QIOChannel"
> 
> Commit 9894dc0cdcc397ee5b26370bc53da6d360a363c2 “char: convert from 
> GIOChannel to QIOChannel”, the old version will call closesocket when 
> tcp_chr_close and udp_chr_close are called. But the new version will 
> not call closesocket.
> 
> This can bring to a socket leak?

Hi, closesocket is called in io/channel-socket.c (qio_channel_socket_finalize).

Thanks,

Paolo

Reply via email to