[vlc-commits] vcd: replace xmalloc with vlc_alloc
Thomas Guillem
git at videolan.org
Sun Nov 12 11:49:40 CET 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sun Nov 12 11:43:42 2017 +0100| [955ee665b6632c0be0fdc4978ff924e87364a23d] | committer: Thomas Guillem
vcd: replace xmalloc with vlc_alloc
And handle the error case.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=955ee665b6632c0be0fdc4978ff924e87364a23d
---
modules/access/vcd/vcd.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules/access/vcd/vcd.c b/modules/access/vcd/vcd.c
index 47373da5fe..abdeaa6246 100644
--- a/modules/access/vcd/vcd.c
+++ b/modules/access/vcd/vcd.c
@@ -265,10 +265,11 @@ static int Control( stream_t *p_access, int i_query, va_list args )
case STREAM_GET_TITLE_INFO:
ppp_title = va_arg( args, input_title_t*** );
- *va_arg( args, int* ) = p_sys->i_titles;
-
/* Duplicate title infos */
- *ppp_title = xmalloc( sizeof(input_title_t *) * p_sys->i_titles );
+ *ppp_title = vlc_alloc( p_sys->i_titles, sizeof(input_title_t *) );
+ if (!*ppp_title)
+ return VLC_ENOMEM;
+ *va_arg( args, int* ) = p_sys->i_titles;
for( int i = 0; i < p_sys->i_titles; i++ )
(*ppp_title)[i] = vlc_input_title_New();
break;
More information about the vlc-commits
mailing list