[vlc-devel] [RFC 26/38] access/archive/access: replaced usage of xmalloc
Filip Roséen
filip at videolabs.io
Mon Jun 27 13:43:37 CEST 2016
---
modules/access/archive/access.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/modules/access/archive/access.c b/modules/access/archive/access.c
index 09858eb..f85a576 100644
--- a/modules/access/archive/access.c
+++ b/modules/access/archive/access.c
@@ -107,7 +107,10 @@ static int FindVolumes(access_t *p_access, struct archive *p_archive, const char
if (!strcmp(&psz_uri[i_uri_size - i_match_size], patterns[i].psz_match))
{
- char **ppsz_files = xmalloc(sizeof(char *) * patterns[i].i_max);
+ char **ppsz_files = malloc(sizeof(char *) * patterns[i].i_max);
+
+ if( unlikely( !ppsz_files ) )
+ return VLC_ENOMEM;
for (unsigned j = patterns[i].i_min; j < patterns[i].i_max; j++)
{
@@ -347,7 +350,12 @@ int AccessOpen(vlc_object_t *p_object)
/* Try to list existing volumes */
char **ppsz_files = NULL;
unsigned int i_files = 0;
- FindVolumes(p_access, p_sys->p_archive, psz_base, &ppsz_files, &i_files);
+
+ if( FindVolumes(p_access, p_sys->p_archive, psz_base, &ppsz_files, &i_files) )
+ {
+ free( psz_base );
+ goto error;
+ }
p_sys->i_callback_data = 1 + i_files;
p_sys->p_callback_data = malloc(sizeof(callback_data_t) * p_sys->i_callback_data);
--
2.9.0
More information about the vlc-devel
mailing list