static int open_file( char *psz_filename, hnd_t *p_handle, cli_output_opt_t *opt )
{
- flv_hnd_t *p_flv = malloc( sizeof(*p_flv) );
*p_handle = NULL;
+ flv_hnd_t *p_flv = calloc( 1, sizeof(flv_hnd_t) );
if( !p_flv )
return -1;
- memset( p_flv, 0, sizeof(*p_flv) );
p_flv->b_dts_compress = opt->use_dts_compress;
flv_buffer *flv_create_writer( const char *filename )
{
- flv_buffer *c = malloc( sizeof(*c) );
-
+ flv_buffer *c = calloc( 1, sizeof(flv_buffer) );
if( !c )
return NULL;
- memset( c, 0, sizeof(*c) );
if( !strcmp( filename, "-" ) )
c->fp = stdout;
static int open_file( char *psz_filename, hnd_t *p_handle, cli_output_opt_t *opt )
{
- mkv_hnd_t *p_mkv;
-
*p_handle = NULL;
-
- p_mkv = malloc( sizeof(*p_mkv) );
+ mkv_hnd_t *p_mkv = calloc( 1, sizeof(mkv_hnd_t) );
if( !p_mkv )
return -1;
- memset( p_mkv, 0, sizeof(*p_mkv) );
-
p_mkv->w = mk_create_writer( psz_filename );
if( !p_mkv->w )
{
}
else
{
- c = malloc( sizeof(*c) );
+ c = calloc( 1, sizeof(mk_context) );
if( !c )
return NULL;
- memset( c, 0, sizeof(*c) );
}
c->parent = parent;
mk_writer *mk_create_writer( const char *filename )
{
- mk_writer *w = malloc( sizeof(*w) );
+ mk_writer *w = calloc( 1, sizeof(mk_writer) );
if( !w )
return NULL;
- memset( w, 0, sizeof(*w) );
-
w->root = mk_create_context( w, NULL, 0 );
if( !w->root )
{
static int open_file( char *psz_filename, hnd_t *p_handle, cli_output_opt_t *opt )
{
- mp4_hnd_t *p_mp4;
-
*p_handle = NULL;
FILE *fh = x264_fopen( psz_filename, "w" );
if( !fh )
FAIL_IF_ERR( !x264_is_regular_file( fh ), "mp4", "MP4 output is incompatible with non-regular file `%s'\n", psz_filename )
fclose( fh );
- if( !(p_mp4 = malloc( sizeof(mp4_hnd_t) )) )
+ mp4_hnd_t *p_mp4 = calloc( 1, sizeof(mp4_hnd_t) );
+ if( !p_mp4 )
return -1;
- memset( p_mp4, 0, sizeof(mp4_hnd_t) );
-
#ifdef _WIN32
/* GPAC doesn't support Unicode filenames. */
char ansi_filename[MAX_PATH];