From 8f937a9b7bb90e20b966fb3077c4bd81ecb13929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <rdenis@simphalempin.com> Date: Tue, 1 Jul 2008 22:39:33 +0300 Subject: [PATCH] SAP: remotely trigerrable memory leak (CID #70) --- modules/services_discovery/sap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c index 3d664de5a5..f7723d675a 100644 --- a/modules/services_discovery/sap.c +++ b/modules/services_discovery/sap.c @@ -771,10 +771,15 @@ static int ParseSAP( services_discovery_t *p_sd, uint8_t *p_buffer, int i_read ) p_sd->p_sys->b_parse == VLC_FALSE ) { if( p_sdp->psz_uri ) free( p_sdp->psz_uri ); - asprintf( &p_sdp->psz_uri, "sdp://%s", p_sdp->psz_sdp ); + if( asprintf( &p_sdp->psz_uri, "sdp://%s", p_sdp->psz_sdp ) == -1 ) + p_sdp->psz_uri = NULL; } - if( p_sdp->psz_uri == NULL ) return VLC_EGENERIC; + if( p_sdp->psz_uri == NULL ) + { + FreeSDP( p_sdp ); + return VLC_EGENERIC; + } for( i = 0 ; i< p_sd->p_sys->i_announces ; i++ ) { -- 2.25.4