From: Victor Julien Date: Tue, 25 Aug 2020 14:06:34 +0000 (+0200) Subject: threshold: fix potential memory leak X-Git-Tag: suricata-6.0.0-rc1~102 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5325%2Fhead;p=thirdparty%2Fsuricata.git threshold: fix potential memory leak --- diff --git a/src/util-threshold-config.c b/src/util-threshold-config.c index 8b57ff7f75..b08935db06 100644 --- a/src/util-threshold-config.c +++ b/src/util-threshold-config.c @@ -643,7 +643,7 @@ static int ParseThresholdRule(DetectEngineCtx *de_ctx, char *rawstr, uint8_t *ret_parsed_type, uint8_t *ret_parsed_track, uint32_t *ret_parsed_count, uint32_t *ret_parsed_seconds, uint32_t *ret_parsed_timeout, uint8_t *ret_parsed_new_action, - const char **ret_th_ip) + char **ret_th_ip) { char th_rule_type[32]; char th_gid[16]; @@ -968,7 +968,7 @@ static int SCThresholdConfAddThresholdtype(char *rawstr, DetectEngineCtx *de_ctx uint32_t parsed_count = 0; uint32_t parsed_seconds = 0; uint32_t parsed_timeout = 0; - const char *th_ip = NULL; + char *th_ip = NULL; uint32_t id = 0, gid = 0; int r = 0; @@ -991,10 +991,11 @@ static int SCThresholdConfAddThresholdtype(char *rawstr, DetectEngineCtx *de_ctx goto error; } + SCFree(th_ip); return 0; error: if (th_ip != NULL) - SCFree((char *)th_ip); + SCFree(th_ip); return -1; }