From 66c6c069166bee3b008ebd8da8e328a242096745 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 11 Dec 2013 10:13:02 +0100 Subject: [PATCH] http: clear header pointer on realloc failure Fixes: detect-engine-hhd.c:188:5: warning: Use of memory after it is freed return headers_buffer; --- src/detect-engine-hhd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/detect-engine-hhd.c b/src/detect-engine-hhd.c index 759c826a02..757da0b1bf 100644 --- a/src/detect-engine-hhd.c +++ b/src/detect-engine-hhd.c @@ -158,8 +158,10 @@ static uint8_t *DetectEngineHHDGetBufferForTX(htp_tx_t *tx, uint64_t tx_id, /* the extra 4 bytes if for ": " and "\r\n" */ uint8_t *new_headers_buffer = SCRealloc(headers_buffer, headers_buffer_len + size1 + size2 + 4); if (unlikely(new_headers_buffer == NULL)) { - if (headers_buffer != NULL) + if (headers_buffer != NULL) { SCFree(headers_buffer); + headers_buffer = NULL; + } det_ctx->hhd_buffers[index] = NULL; det_ctx->hhd_buffers_len[index] = 0; goto end;