Skip to content

Commit d713a5d

Browse files
cosmo0920edsiper
authored andcommitted
gzip: Destroy with miniz stream cleanly
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent 0780b08 commit d713a5d

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/flb_gzip.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,9 +1007,20 @@ void *flb_gzip_decompression_context_create()
10071007

10081008
void flb_gzip_decompression_context_destroy(void *context)
10091009
{
1010-
if (context != NULL) {
1011-
flb_free(context);
1010+
struct flb_gzip_decompression_context *inner_context;
1011+
1012+
if (context == NULL) {
1013+
return;
1014+
}
1015+
1016+
inner_context = (struct flb_gzip_decompression_context *) context;
1017+
1018+
if (inner_context->miniz_stream.state != NULL) {
1019+
mz_inflateEnd(&inner_context->miniz_stream);
1020+
memset(&inner_context->miniz_stream, 0, sizeof(mz_stream));
10121021
}
1022+
1023+
flb_free(inner_context);
10131024
}
10141025

10151026
int flb_is_http_session_gzip_compressed(struct mk_http_session *session)

0 commit comments

Comments
 (0)