[PATCH v2 10/10] vnc-auth-sasl: Plug memleak in vnc_socket_ip_addr_string

Pan Nengyuan posted 10 patches 5 years, 5 months ago
Maintainers: Hailiang Zhang <zhang.zhanghailiang@huawei.com>, Markus Armbruster <armbru@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Juan Quintela <quintela@redhat.com>, Michael Roth <mdroth@linux.vnet.ibm.com>, Gerd Hoffmann <kraxel@redhat.com>, Max Reitz <mreitz@redhat.com>, Richard Henderson <rth@twiddle.net>, Eduardo Habkost <ehabkost@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Viktor Prutyanov <viktor.prutyanov@phystech.edu>
[PATCH v2 10/10] vnc-auth-sasl: Plug memleak in vnc_socket_ip_addr_string
Posted by Pan Nengyuan 5 years, 5 months ago
'addr' is forgot to free in vnc_socket_ip_addr_string error path. Fix that.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
---
Cc: Gerd Hoffmann <kraxel@redhat.com>
---
- V2: no changes in v2.
---
 ui/vnc-auth-sasl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c
index 7b2b09f242..0517b2ead9 100644
--- a/ui/vnc-auth-sasl.c
+++ b/ui/vnc-auth-sasl.c
@@ -522,6 +522,7 @@ vnc_socket_ip_addr_string(QIOChannelSocket *ioc,
 
     if (addr->type != SOCKET_ADDRESS_TYPE_INET) {
         error_setg(errp, "Not an inet socket type");
+        qapi_free_SocketAddress(addr);
         return NULL;
     }
     ret = g_strdup_printf("%s;%s", addr->u.inet.host, addr->u.inet.port);
-- 
2.18.2


Re: [PATCH v2 10/10] vnc-auth-sasl: Plug memleak in vnc_socket_ip_addr_string
Posted by Gerd Hoffmann 5 years, 5 months ago
On Mon, Aug 31, 2020 at 09:43:15AM -0400, Pan Nengyuan wrote:
> 'addr' is forgot to free in vnc_socket_ip_addr_string error path. Fix that.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
> Reviewed-by: Li Qiang <liq3ea@gmail.com>
> ---
> Cc: Gerd Hoffmann <kraxel@redhat.com>

added to UI queue.

thanks,
  Gerd