From: Victor Julien Date: Tue, 24 Sep 2013 17:59:54 +0000 (+0200) Subject: Http: fix memory leaks when cleaning up our per-tx storage X-Git-Tag: suricata-2.0beta2~335 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67c12c61d39ee9c8a2c7a0de09749f147f5ef7ba;p=thirdparty%2Fsuricata.git Http: fix memory leaks when cleaning up our per-tx storage --- 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);