[vlc-devel] [PATCH 2/4] avahi: Fix leaking AvahiServiceResolver in the error paths
Stefan Brüns
stefan.bruens at rwth-aachen.de
Wed Dec 26 03:21:02 CET 2018
Free service resolver instances before returning.
---
modules/services_discovery/avahi.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/modules/services_discovery/avahi.c b/modules/services_discovery/
avahi.c
index 1d71cc82d3..aa58c7f673 100644
--- a/modules/services_discovery/avahi.c
+++ b/modules/services_discovery/avahi.c
@@ -148,7 +148,10 @@ static void resolve_callback(
avahi_address_snprint(a, (sizeof(a)/sizeof(a[0]))-1, address);
if( protocol == AVAHI_PROTO_INET6 )
if( asprintf( &psz_addr, "[%s]", a ) == -1 )
+ {
+ avahi_service_resolver_free( r );
return;
+ }
const char *psz_protocol = NULL;
for( unsigned int i = 0; i < NB_PROTOCOLS; i++ )
@@ -157,7 +160,11 @@ static void resolve_callback(
psz_protocol = protocols[i].psz_protocol;
}
if( psz_protocol == NULL )
+ {
+ free( psz_addr );
+ avahi_service_resolver_free( r );
return;
+ }
if( txt != NULL )
asl = avahi_string_list_find( txt, "path" );
@@ -175,6 +182,7 @@ static void resolve_callback(
port, value ) == -1 )
{
free( psz_addr );
+ avahi_service_resolver_free( r );
return;
}
}
@@ -190,6 +198,7 @@ static void resolve_callback(
psz_addr != NULL ? psz_addr : a, port ) == -1 )
{
free( psz_addr );
+ avahi_service_resolver_free( r );
return;
}
}
--
2.20.1
--
Stefan Brüns / Bergstraße 21 / 52062 Aachen
home: +49 241 53809034 mobile: +49 151 50412019
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part.
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20181226/33e9ee31/attachment.sig>
More information about the vlc-devel
mailing list