diff options
Diffstat (limited to 'src/streams-zlib.cpp')
| -rw-r--r-- | src/streams-zlib.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/streams-zlib.cpp b/src/streams-zlib.cpp index cbe6a75fe..5784a17cf 100644 --- a/src/streams-zlib.cpp +++ b/src/streams-zlib.cpp @@ -104,15 +104,19 @@ int ZlibBuffer::do_consume(guint8 *buf, int nbytes) int ZlibBuffer::do_consume_and_inflate(int nbytes) { - guint8 buf[nbytes]; - if (consume(buf, nbytes) == EOF) - return EOF; - - GByteArray *gba = inflate(buf, nbytes); - copy_to_get(gba->data, gba->len); + guint8 *buf=new guint8[nbytes]; + + int ret=consume(buf, nbytes); + + if ( ret != EOF ) { + ret = 1; + GByteArray *gba = inflate(buf, nbytes); + copy_to_get(gba->data, gba->len); + g_byte_array_free(gba, TRUE); + } - g_byte_array_free(gba, TRUE); - return 1; + delete [] buf; + return ret; } int ZlibBuffer::consume_and_inflate() |
