[vlc-commits] liveHTTP: use calloc to ensure correct initiliazation of members
LANGLOIS Olivier PIS -EXT
git at videolan.org
Sun Nov 3 18:42:00 CET 2013
vlc | branch: master | LANGLOIS Olivier PIS -EXT <olivier.pis.langlois at transport.alstom.com> | Tue Oct 1 22:11:41 2013 +0000| [4de6f1cd6a24a504bdcf2f54e12ceb84b242d5d3] | committer: Jean-Baptiste Kempf
liveHTTP: use calloc to ensure correct initiliazation of members
Sometimes, f_seglen ended up being garbage and resulted to a very long duration for the first segment in the m3u8 index file
Signed-off-by: Olivier Langlois olivier at trillion01.com
Acked-by: Ilkka Ollakka <ileoo at videolan.org>
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4de6f1cd6a24a504bdcf2f54e12ceb84b242d5d3
---
modules/access_output/livehttp.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/modules/access_output/livehttp.c b/modules/access_output/livehttp.c
index 60bb0c7..c14137c 100644
--- a/modules/access_output/livehttp.c
+++ b/modules/access_output/livehttp.c
@@ -221,7 +221,7 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC;
}
- if( unlikely( !( p_sys = malloc ( sizeof( *p_sys ) ) ) ) )
+ if( unlikely( !( p_sys = calloc ( 1, sizeof( *p_sys ) ) ) ) )
return VLC_ENOMEM;
p_sys->i_seglen = var_GetInteger( p_access, SOUT_CFG_PREFIX "seglen" );
@@ -828,12 +828,10 @@ static ssize_t openNextFile( sout_access_out_t *p_access, sout_access_out_sys_t
uint32_t i_newseg = p_sys->i_segment + 1;
/* Create segment and fill it info that we can (everything excluding duration */
- output_segment_t *segment = (output_segment_t*)malloc(sizeof(output_segment_t));
+ output_segment_t *segment = (output_segment_t*)calloc(1, sizeof(output_segment_t));
if( unlikely( !segment ) )
return -1;
- memset( segment, 0 , sizeof( output_segment_t ) );
-
segment->i_segment_number = i_newseg;
segment->psz_filename = formatSegmentPath( p_access->psz_path, i_newseg, true );
char *psz_idxFormat = p_sys->psz_indexUrl ? p_sys->psz_indexUrl : p_access->psz_path;
More information about the vlc-commits
mailing list