changeset 2529:f6a13db551aa libavcodec

10l (deallocated memory again)
author lorenm
date Mon, 28 Feb 2005 05:27:21 +0000
parents 5b738c5093ce
children eace30b70601
files flac.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flac.c	Sun Feb 27 23:43:24 2005 +0000
+++ b/flac.c	Mon Feb 28 05:27:21 2005 +0000
@@ -637,10 +637,17 @@
                 switch(metadata_type)
                 {
                 case METADATA_TYPE_STREAMINFO:{
-                    int bits_count= get_bits_count(&s->gb);
-
                     metadata_streaminfo(s);
 
+                    /* Buffer might have been reallocated, reinit bitreader */
+                    if(buf != &s->bitstream[s->bitstream_index])
+                    {
+                        int bits_count = get_bits_count(&s->gb);
+                        buf= &s->bitstream[s->bitstream_index];
+                        init_get_bits(&s->gb, buf, buf_size*8);
+                        skip_bits(&s->gb, bits_count);
+                    }
+ 
                     dump_headers(s);
                     break;}
                 default: