Project

General

Profile

Actions

Bug #7466

open

Lua Flowvar memory leak

Added by Hans Vermeer 9 days ago. Updated 5 days ago.

Status:
In Progress
Priority:
Normal
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

In LuaSetFlowvar -> LuaSetFlowvarByKey, the key is malloced:

uint8_t *keybuf = SCMalloc(keylen+1);
// ..
FlowVarAddKeyValue(f, keybuf, (uint16_t)keylen, buffer, (uint16_t)len);

However, this is never free'd (FLOW_DESTROY / FLOW_RECYCLE -> GenericVarFree -> FlowVarFree)

void FlowVarFree(FlowVar *fv)
{
    if (fv == NULL)
        return;

    if (fv->datatype == FLOWVAR_TYPE_STR) {
        if (fv->data.fv_str.value != NULL)
            SCFree(fv->data.fv_str.value);
    }
    SCFree(fv);
}

Leading to potential memory leaks.


Files

lua-memleak.tar.gz (2.78 KB) lua-memleak.tar.gz Hans Vermeer, 12/18/2024 01:39 PM
Actions

Also available in: Atom PDF