diff mbox

qemu-sockets: use qapi_free_SocketAddress in cleanup

Message ID 20160706164246.22116-1-marcandre.lureau@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marc-André Lureau July 6, 2016, 4:42 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Commit 74b6ce43e3 uses the wrong free API for a SocketAddress, that
may leak some linked data.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 util/qemu-sockets.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Blake July 6, 2016, 8:18 p.m. UTC | #1
On 07/06/2016 10:42 AM, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Commit 74b6ce43e3 uses the wrong free API for a SocketAddress, that
> may leak some linked data.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  util/qemu-sockets.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>


> 
> diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
> index fb83d48..777af49 100644
> --- a/util/qemu-sockets.c
> +++ b/util/qemu-sockets.c
> @@ -1012,7 +1012,7 @@ void socket_listen_cleanup(int fd, Error **errp)
>          }
>      }
>  
> -    g_free(addr);
> +    qapi_free_SocketAddress(addr);
>  }
>  
>  int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp)
>
Shannon Zhao July 8, 2016, 8:15 a.m. UTC | #2
On 2016/7/7 0:42, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Commit 74b6ce43e3 uses the wrong free API for a SocketAddress, that
> may leak some linked data.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
I'm planing to send a patch, then I find this :)

Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>

> ---
>  util/qemu-sockets.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
> index fb83d48..777af49 100644
> --- a/util/qemu-sockets.c
> +++ b/util/qemu-sockets.c
> @@ -1012,7 +1012,7 @@ void socket_listen_cleanup(int fd, Error **errp)
>          }
>      }
>  
> -    g_free(addr);
> +    qapi_free_SocketAddress(addr);
>  }
>  
>  int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp)
>
Paolo Bonzini July 8, 2016, 2:03 p.m. UTC | #3
On 06/07/2016 18:42, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Commit 74b6ce43e3 uses the wrong free API for a SocketAddress, that
> may leak some linked data.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  util/qemu-sockets.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
> index fb83d48..777af49 100644
> --- a/util/qemu-sockets.c
> +++ b/util/qemu-sockets.c
> @@ -1012,7 +1012,7 @@ void socket_listen_cleanup(int fd, Error **errp)
>          }
>      }
>  
> -    g_free(addr);
> +    qapi_free_SocketAddress(addr);
>  }
>  
>  int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp)
> 

Queued, thanks.

Paolo
diff mbox

Patch

diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index fb83d48..777af49 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -1012,7 +1012,7 @@  void socket_listen_cleanup(int fd, Error **errp)
         }
     }
 
-    g_free(addr);
+    qapi_free_SocketAddress(addr);
 }
 
 int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp)