Project

General

Profile

Actions

Bug #8146

open

utils-spm-hs: missing deallocators on hs_compile failure

Added by Sergey Zhidkih 2 days ago. Updated about 20 hours ago.

Status:
Assigned
Priority:
Normal
Target version:
Affected Versions:
Effort:
low
Difficulty:
Label:

Description

During fuzzing siginit discovered two minor memory leaks in HSBuildDatabase which is caused by missing deallocators when Hyperscan fails to compile expression.

The problem is missing deallocator for expression and missing deallocator for Hyperscan error.

char *expr = HSRenderPattern(needle, needle_len);

hs_error_t err = hs_compile(expr, flags, HS_MODE_BLOCK, NULL, &db,
                             &compile_err);
if (err != HS_SUCCESS) {
    SCLogError("Unable to compile '%s' with Hyperscan, " 
               "returned %d.",
            expr, err);
    return -1;
}

SCFree(expr);

Actions

Also available in: Atom PDF