Commit 4de6f1cd authored by LANGLOIS Olivier PIS -EXT's avatar LANGLOIS Olivier PIS -EXT Committed by 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@trillion01.com
Acked-by: default avatarIlkka Ollakka <ileoo@videolan.org>
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent a815f81c
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment