[vlc-commits] demux: avformat: check get_attachments allocations
Francois Cartegnie
git at videolan.org
Mon Oct 30 22:19:45 CET 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Oct 30 22:10:56 2017 +0100| [6f02c8c2059a1c20a06550b296f6bb2841dda9c3] | committer: Francois Cartegnie
demux: avformat: check get_attachments allocations
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6f02c8c2059a1c20a06550b296f6bb2841dda9c3
---
modules/demux/avformat/demux.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 8a948c0ed1..fe9c33b052 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -1089,10 +1089,17 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
if( p_sys->i_attachments <= 0 )
return VLC_EGENERIC;
- *pi_int = p_sys->i_attachments;;
- *ppp_attach = xmalloc( sizeof(input_attachment_t*) * p_sys->i_attachments );
+ *ppp_attach = malloc( sizeof(input_attachment_t*) * p_sys->i_attachments );
+ if( *ppp_attach == NULL )
+ return VLC_EGENERIC;
+
for( i = 0; i < p_sys->i_attachments; i++ )
+ {
(*ppp_attach)[i] = vlc_input_attachment_Duplicate( p_sys->attachments[i] );
+ if((*ppp_attach)[i] == NULL)
+ break;
+ }
+ *pi_int = i;
return VLC_SUCCESS;
}
More information about the vlc-commits
mailing list