From c3074295c3a23dba67814ce82242ac64b59b57a7 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Tue, 3 Mar 2026 12:10:24 +0100 Subject: [PATCH] Fix uninitialized keyParams in ptools_create_backend_event 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 --- 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));