From f833a61089cdc9343ecfc2dadf7e2e643c1b8110 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Thu, 16 Jun 2016 10:32:44 -0300 Subject: [PATCH] Fix memory leak on html dentity decode transformation --- src/actions/transformations/html_entity_decode.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/actions/transformations/html_entity_decode.cc b/src/actions/transformations/html_entity_decode.cc index 40934eb1..c2c273f7 100644 --- a/src/actions/transformations/html_entity_decode.cc +++ b/src/actions/transformations/html_entity_decode.cc @@ -105,7 +105,7 @@ int HtmlEntityDecode::inplace(unsigned char *input, u_int64_t input_len) { memset(x, '\0', (j - k) + 1); memcpy(x, (const char *)&input[k], j - k); *d++ = (unsigned char)strtol(x, NULL, 16); - + free(x); count++; /* Skip over the semicolon if it's there. */ @@ -132,7 +132,7 @@ int HtmlEntityDecode::inplace(unsigned char *input, u_int64_t input_len) { memset(x, '\0', (j - k) + 1); memcpy(x, (const char *)&input[k], j - k); *d++ = (unsigned char)strtol(x, NULL, 10); - + free(x); count++; /* Skip over the semicolon if it's there. */ @@ -175,8 +175,10 @@ int HtmlEntityDecode::inplace(unsigned char *input, u_int64_t input_len) { /* We do no want to convert this entity, * copy the raw data over. */ copy = j - k + 1; + free(x); goto HTML_ENT_OUT; } + free(x); count++;