vlc | branch: master | Hugo Beauzée-Luyssen <[email protected]> | Tue Mar 20 14:28:39 2018 +0100| [69b5dffa522662b0fab2877dc2d9bb06fad6bab6] | committer: Hugo Beauzée-Luyssen
hds: Fix leak on error CID #1402695 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=69b5dffa522662b0fab2877dc2d9bb06fad6bab6 --- modules/stream_filter/hds/hds.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/modules/stream_filter/hds/hds.c b/modules/stream_filter/hds/hds.c index 9cf1b0a3c4..3de487f436 100644 --- a/modules/stream_filter/hds/hds.c +++ b/modules/stream_filter/hds/hds.c @@ -1329,10 +1329,16 @@ static int parse_Manifest( stream_t *s, manifest_t *m ) case XML_READER_STARTELEM: if( current_element_idx == 0 && element_stack[current_element_idx] == 0 ) { if( !( element_stack[current_element_idx] = strdup( node ) ) ) + { + free(media_id); return VLC_ENOMEM; + } } else { if ( !( element_stack[++current_element_idx] = strdup( node ) ) ) + { + free(media_id); return VLC_ENOMEM; + } } break; @@ -1362,6 +1368,7 @@ static int parse_Manifest( stream_t *s, manifest_t *m ) if( media_idx == MAX_MEDIA_ELEMENTS ) { msg_Err( (vlc_object_t*) s, "Too many media elements, quitting" ); + free(media_id); return VLC_EGENERIC; } @@ -1370,17 +1377,26 @@ static int parse_Manifest( stream_t *s, manifest_t *m ) if( !strcmp(attr_name, "streamId" ) ) { if( !( medias[media_idx].stream_id = strdup( attr_value ) ) ) + { + free(media_id); return VLC_ENOMEM; + } } else if( !strcmp(attr_name, "url" ) ) { if( !( medias[media_idx].media_url = strdup( attr_value ) ) ) + { + free(media_id); return VLC_ENOMEM; + } } else if( !strcmp(attr_name, "bootstrapInfoId" ) ) { if( !( medias[media_idx].bootstrap_id = strdup( attr_value ) ) ) + { + free(media_id); return VLC_ENOMEM; + } } else if( !strcmp(attr_name, "bitrate" ) ) { @@ -1397,17 +1413,26 @@ static int parse_Manifest( stream_t *s, manifest_t *m ) if( !strcmp(attr_name, "url" ) ) { if( !( bootstraps[bootstrap_idx].url = strdup( attr_value ) ) ) + { + free(media_id); return VLC_ENOMEM; + } } else if( !strcmp(attr_name, "id" ) ) { if( !( bootstraps[bootstrap_idx].id = strdup( attr_value ) ) ) - return VLC_ENOMEM; + { + free(media_id); + return VLC_ENOMEM; + } } else if( !strcmp(attr_name, "profile" ) ) { if( !( bootstraps[bootstrap_idx].profile = strdup( attr_value ) ) ) + { + free(media_id); return VLC_ENOMEM; + } } } } @@ -1457,7 +1482,10 @@ static int parse_Manifest( stream_t *s, manifest_t *m ) vlc_b64_decode_binary( (uint8_t**)&medias[mi].metadata, start ); if ( ! medias[mi].metadata ) + { + free(media_id); return VLC_ENOMEM; + } uint8_t *end_marker = medias[mi].metadata + medias[mi].metadata_len - sizeof(amf_object_end); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
