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