SCReturnPtr(NULL, "void");
}
+static void HtpTxUserDataFree(HtpTxUserData *htud) {
+ if (htud) {
+ 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);
+ }
+}
+
/** \brief Function to frees the HTTP state memory and also frees the HTTP
* connection parser memory which was used by the HTP library
*/
if (tx != NULL) {
HtpTxUserData *htud = (HtpTxUserData *) htp_tx_get_user_data(tx);
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);
+ HtpTxUserDataFree(htud);
htp_tx_set_user_data(tx, NULL);
}
}
/* This will remove obsolete body chunks */
HtpTxUserData *htud = (HtpTxUserData *) htp_tx_get_user_data(tx);
if (htud != NULL) {
- HtpBodyFree(&htud->request_body);
- HtpBodyFree(&htud->response_body);
- SCFree(htud);
+ HtpTxUserDataFree(htud);
htp_tx_set_user_data(tx, NULL);
}
tx_ud->request_headers_raw_len + tx_data->len);
if (tx_ud->request_headers_raw == NULL) {
tx_ud->request_headers_raw_len = 0;
+ HtpTxUserDataFree(tx_ud);
htp_tx_set_user_data(tx_data->tx, NULL);
- SCFree(tx_ud);
return HTP_OK;
}
memcpy(tx_ud->request_headers_raw + tx_ud->request_headers_raw_len,
tx_ud->response_headers_raw_len + tx_data->len);
if (tx_ud->response_headers_raw == NULL) {
tx_ud->response_headers_raw_len = 0;
+ HtpTxUserDataFree(tx_ud);
htp_tx_set_user_data(tx_data->tx, NULL);
- SCFree(tx_ud);
return HTP_OK;
}
memcpy(tx_ud->response_headers_raw + tx_ud->response_headers_raw_len,