[vlc-commits] SAP: NULL dereference on error path
Rémi Denis-Courmont
git at videolan.org
Wed Apr 23 18:56:34 CEST 2014
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr 23 19:56:21 2014 +0300| [baee60051965ac6ec54dd86564ba7e8a09e3f0c2] | committer: Rémi Denis-Courmont
SAP: NULL dereference on error path
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=baee60051965ac6ec54dd86564ba7e8a09e3f0c2
---
modules/services_discovery/sap.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index 29933fd..430d234 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -856,15 +856,19 @@ sap_announce_t *CreateAnnounce( services_discovery_t *p_sd, uint32_t *i_source,
p_input = input_item_NewWithType( p_sap->p_sdp->psz_uri,
p_sdp->psz_sessionname,
0, NULL, 0, -1, ITEM_TYPE_NET );
- vlc_meta_t *p_meta = vlc_meta_New();
- vlc_meta_Set( p_meta, vlc_meta_Description, p_sdp->psz_sessioninfo );
- p_input->p_meta = p_meta;
- p_sap->p_item = p_input;
- if( !p_input )
+ if( unlikely(p_input == NULL) )
{
free( p_sap );
return NULL;
}
+ p_sap->p_item = p_input;
+
+ vlc_meta_t *p_meta = vlc_meta_New();
+ if( likely(p_meta != NULL) )
+ {
+ vlc_meta_Set( p_meta, vlc_meta_Description, p_sdp->psz_sessioninfo );
+ p_input->p_meta = p_meta;
+ }
if( p_sdp->rtcp_port )
{
More information about the vlc-commits
mailing list