X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_encoding_api.c;h=bff322882ae8c25dbf4566b8f83c95db324bbaa3;hb=4e4645f7a6e147eb1b4cab1a25176a7ea3f8db0d;hp=6c0d4157b2115ca6b917ffa443c2dc1c675e1186;hpb=eabc03de1d511ce49640322859c6175f27a413e5;p=m6w6%2Fext-http diff --git a/http_encoding_api.c b/http_encoding_api.c index 6c0d415..bff3228 100644 --- a/http_encoding_api.c +++ b/http_encoding_api.c @@ -245,19 +245,13 @@ PHP_HTTP_API STATUS _http_encoding_inflate(const char *data, size_t data_len, ch STATUS status; z_stream Z; - *decoded = NULL; - *decoded_len = 0; - -retry_inflate: do { Z.zalloc = Z_NULL; Z.zfree = Z_NULL; if (!max) { - if (!*decoded) { - *decoded_len = data_len * 2; - *decoded = emalloc(*decoded_len + 1); - } + *decoded_len = data_len * 2; + *decoded = emalloc(*decoded_len + 1); } else { size_t new_len = *decoded_len << 2; char *new_ptr = erealloc_recoverable(*decoded, new_len + 1); @@ -270,6 +264,7 @@ retry_inflate: } } +retry_inflate: Z.next_in = (Bytef *) data; Z.avail_in = data_len; Z.next_out = (Bytef *) *decoded;