]> git.sur5r.net Git - u-boot/blobdiff - lib_generic/gunzip.c
Fix gunzip in case of insufficient output buffer
[u-boot] / lib_generic / gunzip.c
index 74f0bf9f3e1d042a93c877be418961ebfc40bb61..5bcf5b7b24f734ee5274156f809a8996147966db 100644 (file)
@@ -102,8 +102,9 @@ int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp)
        s.next_out = dst;
        s.avail_out = dstlen;
        r = inflate(&s, Z_FINISH);
-       if (r != Z_OK && r != Z_STREAM_END) {
+       if (r != Z_STREAM_END) {
                printf ("Error: inflate() returned %d\n", r);
+               inflateEnd(&s);
                return (-1);
        }
        *lenp = s.next_out - (unsigned char *) dst;