From beaa76adfbbcae12f136831c89827136e615ae6f Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Tue, 3 Mar 2026 12:10:44 +0100 Subject: [PATCH] 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 --- pclsync/ptools.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pclsync/ptools.c b/pclsync/ptools.c index f70e2f7..07fb4f2 100644 --- a/pclsync/ptools.c +++ b/pclsync/ptools.c @@ -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));