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:
Levi Neely 2026-03-03 12:10:44 +01:00 committed by GitHub
parent c514fa1a29
commit beaa76adfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -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));