From 11cecaa7de94a47ce2664b6dc5183dfce82c8291 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Sat, 7 Mar 2026 18:56:43 +0100 Subject: [PATCH] Fix pcl-dls.1: free errPtr between calls in ptools_set_backend_file_dates() char *errPtr was already used instead of char msgErr[1024], but was not freed between the two ptools_backend_call() invocations. If the first call allocated errPtr, the second would overwrite the pointer without freeing it. Add free(errPtr); errPtr = NULL; between the two calls to eliminate the leak. Ref GH #194. Co-Authored-By: Claude Sonnet 4.6 --- pclsync/ptools.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pclsync/ptools.c b/pclsync/ptools.c index 947ef62..115021c 100644 --- a/pclsync/ptools.c +++ b/pclsync/ptools.c @@ -513,6 +513,12 @@ int ptools_set_backend_file_dates(uint64_t fileid, time_t ctime, time_t mtime) { pdbg_logf(D_NOTICE, "cTime res: [%d]", callRes); + /* Free errPtr before reuse to avoid leak if first call allocated it */ + if (errPtr) { + free(errPtr); + errPtr = NULL; + } + eventParams requiredParams = {5, {PAPI_STR("auth", psync_my_auth), PAPI_NUM("fileid", fileid),