From 67c12c61d39ee9c8a2c7a0de09749f147f5ef7ba Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 24 Sep 2013 19:59:54 +0200 Subject: [PATCH] Http: fix memory leaks when cleaning up our per-tx storage --- src/app-layer-htp.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index 10934e5631..4d1cb83cb2 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -277,6 +277,13 @@ void HTPStateFree(void *state) if (htud != NULL) { HtpBodyFree(&htud->request_body); HtpBodyFree(&htud->response_body); + bstr_free(htud->request_uri_normalized); + if (htud->request_headers_raw) + SCFree(htud->request_headers_raw); + if (htud->response_headers_raw) + SCFree(htud->response_headers_raw); + if (htud->boundary) + SCFree(htud->boundary); SCFree(htud); htp_tx_set_user_data(tx, NULL); } @@ -1938,8 +1945,10 @@ static int HTPCallbackRequestLine(htp_tx_t *tx) return HTP_OK; tx_ud = SCMalloc(sizeof(*tx_ud)); - if (tx_ud == NULL) + if (tx_ud == NULL) { + bstr_free(request_uri_normalized); return HTP_OK; + } memset(tx_ud, 0, sizeof(*tx_ud)); tx_ud->request_uri_normalized = request_uri_normalized; htp_tx_set_user_data(tx, tx_ud);