f086e6
commit 4f47b63e9c971e6391590caf00a0f2a5ed612e67
f086e6
Author: Erik de Castro Lopo <erikd@mega-nerd.com>
f086e6
Date:   Sat Apr 8 18:34:49 2017 +1000
f086e6
f086e6
    stream_decoder.c: Fix a memory leak
f086e6
    
f086e6
    Leak reported by Secunia Research.
f086e6
f086e6
diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c
f086e6
index 14d5fe7f..a5527511 100644
f086e6
--- a/src/libFLAC/stream_decoder.c
f086e6
+++ b/src/libFLAC/stream_decoder.c
f086e6
@@ -1753,6 +1753,9 @@ FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__Stre
f086e6
 					}
f086e6
 					memset (obj->comments[i].entry, 0, obj->comments[i].length) ;
f086e6
 					if (!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->comments[i].entry, obj->comments[i].length)) {
f086e6
+						/* Current i-th entry is bad, so we delete it. */
f086e6
+						free (obj->comments[i].entry) ;
f086e6
+						obj->comments[i].entry = NULL ;
f086e6
 						obj->num_comments = i;
f086e6
 						goto skip;
f086e6
 					}