HtpTxUserData *tx_ud = (HtpTxUserData *) htp_tx_get_user_data(d->tx);
if (tx_ud == NULL) {
- tx_ud = HTPMalloc(sizeof(HtpTxUserData));
- if (unlikely(tx_ud == NULL)) {
- SCReturnInt(HTP_OK);
- }
- memset(tx_ud, 0, sizeof(HtpTxUserData));
-
- /* Set the user data for handling body chunks on this transaction */
- htp_tx_set_user_data(d->tx, tx_ud);
+ SCReturnInt(HTP_OK);
}
if (!tx_ud->response_body_init) {
tx_ud->response_body_init = 1;
HtpTxUserData *tx_ud = (HtpTxUserData *) htp_tx_get_user_data(d->tx);
if (tx_ud == NULL) {
- tx_ud = HTPMalloc(sizeof(HtpTxUserData));
- if (unlikely(tx_ud == NULL)) {
- SCReturnInt(HTP_OK);
- }
- memset(tx_ud, 0, sizeof(HtpTxUserData));
-
- /* Set the user data for handling body chunks on this transaction */
- htp_tx_set_user_data(d->tx, tx_ud);
+ SCReturnInt(HTP_OK);
}
if (!tx_ud->request_body_init) {
tx_ud->request_body_init = 1;
if (hstate->cfg)
StreamTcpReassemblySetMinInspectDepth(hstate->f->protoctx, STREAM_TOSERVER,
hstate->cfg->request.inspect_min_size);
+
+ HtpTxUserData *tx_ud = (HtpTxUserData *) htp_tx_get_user_data(tx);
+ if (tx_ud == NULL) {
+ tx_ud = HTPCalloc(1, sizeof(HtpTxUserData));
+ if (unlikely(tx_ud == NULL)) {
+ SCReturnInt(HTP_OK);
+ }
+ htp_tx_set_user_data(tx, tx_ud);
+ }
SCReturnInt(HTP_OK);
}
if (hstate->cfg)
StreamTcpReassemblySetMinInspectDepth(hstate->f->protoctx, STREAM_TOCLIENT,
hstate->cfg->response.inspect_min_size);
+
+ HtpTxUserData *tx_ud = (HtpTxUserData *) htp_tx_get_user_data(tx);
+ if (tx_ud == NULL) {
+ tx_ud = HTPCalloc(1, sizeof(HtpTxUserData));
+ if (unlikely(tx_ud == NULL)) {
+ SCReturnInt(HTP_OK);
+ }
+ htp_tx_set_user_data(tx, tx_ud);
+ }
SCReturnInt(HTP_OK);
}
// shorter string means that uri was encoded
if (res == HTP_OK && prevlen > bstr_len(part)) {
HtpTxUserData *htud = (HtpTxUserData *) htp_tx_get_user_data(tx);
- if (likely(htud == NULL)) {
- htud = HTPCalloc(1, sizeof(*htud));
- if (unlikely(htud == NULL))
- return HTP_OK;
- htp_tx_set_user_data(tx, htud);
- }
+ if (htud == NULL)
+ return HTP_OK;
HtpState *s = htp_connp_get_user_data(tx->connp);
if (s == NULL)
return HTP_OK;
HtpTxUserData *tx_ud = htp_tx_get_user_data(tx_data->tx);
if (tx_ud == NULL) {
- tx_ud = HTPMalloc(sizeof(*tx_ud));
- if (unlikely(tx_ud == NULL))
- return HTP_OK;
- memset(tx_ud, 0, sizeof(*tx_ud));
- htp_tx_set_user_data(tx_data->tx, tx_ud);
+ return HTP_OK;
}
ptmp = HTPRealloc(tx_ud->request_headers_raw,
tx_ud->request_headers_raw_len,
tx_ud->request_headers_raw_len + tx_data->len);
if (ptmp == NULL) {
- /* error: we're freeing the entire user data */
- HtpState *hstate = htp_connp_get_user_data(tx_data->tx->connp);
- HtpTxUserDataFree(hstate, tx_ud);
- htp_tx_set_user_data(tx_data->tx, NULL);
return HTP_OK;
}
tx_ud->request_headers_raw = ptmp;
HtpTxUserData *tx_ud = htp_tx_get_user_data(tx_data->tx);
if (tx_ud == NULL) {
- tx_ud = HTPMalloc(sizeof(*tx_ud));
- if (unlikely(tx_ud == NULL))
- return HTP_OK;
- memset(tx_ud, 0, sizeof(*tx_ud));
- htp_tx_set_user_data(tx_data->tx, tx_ud);
+ return HTP_OK;
}
ptmp = HTPRealloc(tx_ud->response_headers_raw,
tx_ud->response_headers_raw_len,
tx_ud->response_headers_raw_len + tx_data->len);
if (ptmp == NULL) {
- /* error: we're freeing the entire user data */
- HtpState *hstate = htp_connp_get_user_data(tx_data->tx->connp);
- HtpTxUserDataFree(hstate, tx_ud);
- htp_tx_set_user_data(tx_data->tx, NULL);
return HTP_OK;
}
tx_ud->response_headers_raw = ptmp;
htp_tx_t *tx = (htp_tx_t *)vtx;
HtpTxUserData *tx_ud = htp_tx_get_user_data(tx);
if (tx_ud == NULL) {
- tx_ud = HTPMalloc(sizeof(*tx_ud));
- if (unlikely(tx_ud == NULL))
- return -ENOMEM;
- memset(tx_ud, 0, sizeof(*tx_ud));
- htp_tx_set_user_data(tx, tx_ud);
+ return -ENOMEM;
}
tx_ud->de_state = s;
return 0;