[vlc-commits] ogg: replace xmalloc with vlc_alloc

Thomas Guillem git at videolan.org
Sun Nov 12 11:49:39 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sun Nov 12 11:43:28 2017 +0100| [e247a049daf60003d80717c8c4cd82c3de259d69] | committer: Thomas Guillem

ogg: replace xmalloc with vlc_alloc

And handle the error case.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e247a049daf60003d80717c8c4cd82c3de259d69
---

 modules/demux/ogg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index a75408afd7..b9844a2c19 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -827,8 +827,10 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             if( p_sys->i_attachments <= 0 )
                 return VLC_EGENERIC;
 
+            *ppp_attach = vlc_alloc( p_sys->i_attachments, sizeof(input_attachment_t*) );
+            if (!**ppp_attach)
+                return VLC_ENOMEM;
             *pi_int = p_sys->i_attachments;
-            *ppp_attach = xmalloc( sizeof(input_attachment_t*) * p_sys->i_attachments );
             for( int i = 0; i < p_sys->i_attachments; i++ )
                 (*ppp_attach)[i] = vlc_input_attachment_Duplicate( p_sys->attachments[i] );
             return VLC_SUCCESS;



More information about the vlc-commits mailing list