projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
- Fixed memory leak when HttpUtil::Inflate() fails
[m6w6/ext-http]
/
http_encoding_api.c
diff --git
a/http_encoding_api.c
b/http_encoding_api.c
index c644d914dcfc2a9b77e2c289ae77ff62672c4a8e..3a93a19729f9c9405860eb5a9f80f1c71d38b909 100644
(file)
--- a/
http_encoding_api.c
+++ b/
http_encoding_api.c
@@
-327,10
+327,13
@@
retry_raw_inflate:
Z.avail_in = data_len;
switch (status = http_inflate_rounds(&Z, Z_NO_FLUSH, decoded, decoded_len)) {
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_STREAM_END:
inflateEnd(&Z);
return SUCCESS;
+
+ case Z_OK:
+ status = Z_DATA_ERROR;
+ break;
case Z_DATA_ERROR:
/* raw deflated data? */
case Z_DATA_ERROR:
/* raw deflated data? */
@@
-341,6
+344,10
@@
retry_raw_inflate:
}
}
inflateEnd(&Z);
}
}
inflateEnd(&Z);
+
+ if (decoded_len && *decoded) {
+ efree(*decoded);
+ }
}
http_error_ex(HE_WARNING, HTTP_E_ENCODING, "Could not inflate data: %s", zError(status));
}
http_error_ex(HE_WARNING, HTTP_E_ENCODING, "Could not inflate data: %s", zError(status));