util-mpm-hs.c:340:20: warning: Potential leak of memory pointed to by 'p' [unix.Malloc]
p->sids[0] = sid;
~~~~~~~~~~~^~~~~
1 warning generated.
Incorrect error handling could lead to a memory leak.
(cherry picked from commit
ec84ba1a3c981108af4613fa16d5f13cc19e1f1d)
uint32_t hash = SCHSInitHash(p);
if (ctx->init_hash == NULL) {
- return 0;
+ return -1;
}
if (ctx->init_hash[hash] == NULL) {
memcpy(p->original_pat, pat, patlen);
/* put in the pattern hash */
- SCHSInitHashAdd(ctx, p);
+ if (SCHSInitHashAdd(ctx, p) != 0)
+ goto error;
mpm_ctx->pattern_cnt++;