From: Victor Julien Date: Wed, 11 Dec 2013 09:13:02 +0000 (+0100) Subject: http: clear header pointer on realloc failure X-Git-Tag: suricata-2.0beta2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66c6c069166bee3b008ebd8da8e328a242096745;p=thirdparty%2Fsuricata.git 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; --- 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;