@@ -364,7 +364,7 @@ FLAC_API const char * const FLAC__Metadata_SimpleIteratorStatusString[] = {
364364
365365FLAC_API FLAC__Metadata_SimpleIterator * FLAC__metadata_simple_iterator_new (void )
366366{
367- FLAC__Metadata_SimpleIterator * iterator = calloc (1 , sizeof (FLAC__Metadata_SimpleIterator ));
367+ FLAC__Metadata_SimpleIterator * iterator = safe_calloc_ (1 , sizeof (FLAC__Metadata_SimpleIterator ));
368368
369369 if (0 != iterator ) {
370370 iterator -> file = 0 ;
@@ -961,7 +961,7 @@ FLAC_API const char * const FLAC__Metadata_ChainStatusString[] = {
961961
962962static FLAC__Metadata_Node * node_new_ (void )
963963{
964- return calloc (1 , sizeof (FLAC__Metadata_Node ));
964+ return safe_calloc_ (1 , sizeof (FLAC__Metadata_Node ));
965965}
966966
967967static void node_delete_ (FLAC__Metadata_Node * node )
@@ -1559,7 +1559,7 @@ static FLAC__bool chain_rewrite_file_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHa
15591559
15601560FLAC_API FLAC__Metadata_Chain * FLAC__metadata_chain_new (void )
15611561{
1562- FLAC__Metadata_Chain * chain = calloc (1 , sizeof (FLAC__Metadata_Chain ));
1562+ FLAC__Metadata_Chain * chain = safe_calloc_ (1 , sizeof (FLAC__Metadata_Chain ));
15631563
15641564 if (0 != chain )
15651565 chain_init_ (chain );
@@ -1953,7 +1953,7 @@ FLAC_API void FLAC__metadata_chain_sort_padding(FLAC__Metadata_Chain *chain)
19531953
19541954FLAC_API FLAC__Metadata_Iterator * FLAC__metadata_iterator_new (void )
19551955{
1956- FLAC__Metadata_Iterator * iterator = calloc (1 , sizeof (FLAC__Metadata_Iterator ));
1956+ FLAC__Metadata_Iterator * iterator = safe_calloc_ (1 , sizeof (FLAC__Metadata_Iterator ));
19571957
19581958 /* calloc() implies:
19591959 iterator->current = 0;
@@ -2289,7 +2289,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLA
22892289 block -> data = 0 ;
22902290 }
22912291 else {
2292- if (0 == (block -> data = malloc (block_length )))
2292+ if (0 == (block -> data = safe_malloc_ (block_length )))
22932293 return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR ;
22942294
22952295 if (read_cb (block -> data , 1 , block_length , handle ) != block_length )
@@ -2390,7 +2390,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(
23902390 status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA ;
23912391 goto skip ;
23922392 }
2393- else if (0 == (block -> comments = calloc (block -> num_comments , sizeof (FLAC__StreamMetadata_VorbisComment_Entry )))) {
2393+ else if (0 == (block -> comments = safe_calloc_ (block -> num_comments , sizeof (FLAC__StreamMetadata_VorbisComment_Entry )))) {
23942394 block -> num_comments = 0 ;
23952395 return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR ;
23962396 }
@@ -2460,7 +2460,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_track_cb_(
24602460 if (track -> num_indices == 0 ) {
24612461 track -> indices = 0 ;
24622462 }
2463- else if (0 == (track -> indices = calloc (track -> num_indices , sizeof (FLAC__StreamMetadata_CueSheet_Index ))))
2463+ else if (0 == (track -> indices = safe_calloc_ (track -> num_indices , sizeof (FLAC__StreamMetadata_CueSheet_Index ))))
24642464 return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR ;
24652465
24662466 for (i = 0 ; i < track -> num_indices ; i ++ ) {
@@ -2520,7 +2520,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_cb_(FLAC__
25202520 if (block -> num_tracks == 0 ) {
25212521 return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA ;
25222522 }
2523- else if (0 == (block -> tracks = calloc (block -> num_tracks , sizeof (FLAC__StreamMetadata_CueSheet_Track ))))
2523+ else if (0 == (block -> tracks = safe_calloc_ (block -> num_tracks , sizeof (FLAC__StreamMetadata_CueSheet_Track ))))
25242524 return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR ;
25252525
25262526 for (i = 0 ; i < block -> num_tracks ; i ++ ) {
@@ -2626,7 +2626,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_unknown_cb_(FLAC__I
26262626 block -> data = 0 ;
26272627 }
26282628 else {
2629- if (0 == (block -> data = malloc (block_length )))
2629+ if (0 == (block -> data = safe_malloc_ (block_length )))
26302630 return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR ;
26312631
26322632 if (read_cb (block -> data , 1 , block_length , handle ) != block_length )
0 commit comments