year bump
[m6w6/ext-http] / http_encoding_api.c
index c644d914dcfc2a9b77e2c289ae77ff62672c4a8e..9e0976c58d2b33c5511d80a88cd7b7f3e4b931f7 100644 (file)
@@ -6,7 +6,7 @@
     | modification, are permitted provided that the conditions mentioned |
     | in the accompanying LICENSE file are met.                          |
     +--------------------------------------------------------------------+
-    | Copyright (c) 2004-2007, Michael Wallner <mike@php.net>            |
+    | Copyright (c) 2004-2010, Michael Wallner <mike@php.net>            |
     +--------------------------------------------------------------------+
 */
 
@@ -327,10 +327,13 @@ retry_raw_inflate:
                Z.avail_in = data_len;
                
                switch (status = http_inflate_rounds(&Z, Z_NO_FLUSH, decoded, decoded_len)) {
-                       case Z_OK:
                        case Z_STREAM_END:
                                inflateEnd(&Z);
                                return SUCCESS;
+
+                       case Z_OK:
+                               status = Z_DATA_ERROR;
+                               break;
                        
                        case Z_DATA_ERROR:
                                /* raw deflated data? */
@@ -341,6 +344,10 @@ retry_raw_inflate:
                                }
                }
                inflateEnd(&Z);
+
+               if (decoded_len && *decoded) {
+                       efree(*decoded);
+               }
        }
        
        http_error_ex(HE_WARNING, HTTP_E_ENCODING, "Could not inflate data: %s", zError(status));