Fix uninitialized keyParams in ptools_create_backend_event (#299)
keyParams is only allocated when pCnt > 0 but freed unconditionally. When pCnt == 0, free() is called on an uninitialized pointer (UB). Initialize to NULL so free() is a no-op when allocation is skipped. Fixes GH #214 Co-authored-by: Levi Neely <lkn@darkstar.example.net>
This commit is contained in:
parent
c514fa1a29
commit
beaa76adfb
|
|
@ -95,7 +95,7 @@ int ptools_create_backend_event(const char *binapi, const char *category,
|
|||
int pCnt = params->paramCnt; // Number of optional parameters
|
||||
int mpCnt = 6; // Number of mandatory params
|
||||
int tpCnt; // Total number of parameters
|
||||
char *keyParams;
|
||||
char *keyParams = NULL;
|
||||
char charBuff[30][258];
|
||||
|
||||
sock = papi_connect(binapi, psync_setting_get_bool(0));
|
||||
|
|
|
|||
Loading…
Reference in New Issue