From d9264962d5d5ad3979bf2324707661a1cb70dd8a Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Sat, 3 Sep 2005 01:41:11 +0000 Subject: [PATCH] fix bug in return value for FLAC__stream_decoder_set_metadata_respond_application() and FLAC__stream_decoder_set_metadata_ignore_application() (sf #1235005: https://sourceforge.net/tracker/index.php?func=detail&aid=1235005&group_id=13478&atid=113478) --- doc/html/changelog.html | 1 + src/libFLAC/stream_decoder.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/html/changelog.html b/doc/html/changelog.html index b468d213..b1cb92b6 100644 --- a/doc/html/changelog.html +++ b/doc/html/changelog.html @@ -118,6 +118,7 @@
  • diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c index e235dc0b..ca7b819f 100644 --- a/src/libFLAC/stream_decoder.c +++ b/src/libFLAC/stream_decoder.c @@ -455,8 +455,10 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__ FLAC__ASSERT(0 != decoder->private_->metadata_filter_ids); if(decoder->private_->metadata_filter_ids_count == decoder->private_->metadata_filter_ids_capacity) { - if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)realloc(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity * 2))) - return decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)realloc(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity * 2))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } decoder->private_->metadata_filter_ids_capacity *= 2; } @@ -512,8 +514,10 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__S FLAC__ASSERT(0 != decoder->private_->metadata_filter_ids); if(decoder->private_->metadata_filter_ids_count == decoder->private_->metadata_filter_ids_capacity) { - if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)realloc(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity * 2))) - return decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)realloc(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity * 2))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } decoder->private_->metadata_filter_ids_capacity *= 2; }