detect: fix port parsing memory leak

Leak in error path as seen by scan-build:

  CC       detect-engine-port.o
detect-engine-port.c:1083:13: warning: Potential leak of memory pointed to by 'temp_rule_var_port'
    return -1;
            ^
pull/2952/head
Victor Julien 9 years ago
parent 319a6f48ff
commit 1729ab7d94

@ -977,9 +977,10 @@ static int DetectPortParseDo(const DetectEngineCtx *de_ctx,
temp_rule_var_port = alloc_rule_var_port; temp_rule_var_port = alloc_rule_var_port;
r = DetectPortParseDo(de_ctx, head, nhead, temp_rule_var_port, r = DetectPortParseDo(de_ctx, head, nhead, temp_rule_var_port,
(negate + n_set) % 2, var_list);//negate? negate: n_set); (negate + n_set) % 2, var_list);//negate? negate: n_set);
if (r == -1) if (r == -1) {
SCFree(alloc_rule_var_port);
goto error; goto error;
}
d_set = 0; d_set = 0;
n_set = 0; n_set = 0;
SCFree(alloc_rule_var_port); SCFree(alloc_rule_var_port);

Loading…
Cancel
Save