From: Josh Coalson Date: Wed, 29 May 2002 05:56:39 +0000 (+0000) Subject: fix memory leaks in array resizers X-Git-Tag: 1.2.0~1902 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e6470692adcdc833c78a07803173b48a305242e;p=platform%2Fupstream%2Fflac.git fix memory leaks in array resizers --- diff --git a/src/libFLAC/metadata.c b/src/libFLAC/metadata.c index d55303b..a53891c 100644 --- a/src/libFLAC/metadata.c +++ b/src/libFLAC/metadata.c @@ -1450,8 +1450,10 @@ FLAC__bool FLAC__metadata_object_seekpoint_array_resize(FLAC__StreamMetaData_See FLAC__ASSERT(old_num_points > 0); - if(new_size == 0) + if(new_size == 0) { + free(*object_array); *object_array = 0; + } else if(0 == (*object_array = realloc(*object_array, new_size))) return false; @@ -1561,8 +1563,10 @@ FLAC__bool FLAC__metadata_object_vorbiscomment_entry_array_resize(FLAC__StreamMe free((*object_array)[i].entry); } - if(new_size == 0) + if(new_size == 0) { + free(*object_array); *object_array = 0; + } else if(0 == (*object_array = realloc(*object_array, new_size))) return false;