From: Victor Julien Date: Tue, 20 Feb 2024 15:06:57 +0000 (+0100) Subject: detect: fix memory leak in error handling X-Git-Tag: suricata-7.0.4~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b225ac1b9b0dcc07e123c37e1a498d850d67ecbd;p=thirdparty%2Fsuricata.git detect: fix memory leak in error handling Pointed out by cppcheck: src/detect-parse.c:1544:9: error: Memory leak: sig.init_data [memleak] SCFree(sig); ^ Bug: #6527. (cherry picked from commit eb1d0c2cc2b673a8f751cd88546e7c37e33ab8e0) --- diff --git a/src/detect-parse.c b/src/detect-parse.c index b5e214df24..c3232b97da 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -1540,6 +1540,7 @@ Signature *SigAlloc (void) sig->init_data->buffers = SCCalloc(8, sizeof(SignatureInitDataBuffer)); if (sig->init_data->buffers == NULL) { + SCFree(sig->init_data); SCFree(sig); return NULL; }