From 4ef9767a09ed5e9acae37527eb4a3a66fbfed8f5 Mon Sep 17 00:00:00 2001 From: Hinko Kocevar Date: Tue, 18 Apr 2023 17:48:32 +0200 Subject: [PATCH] call yajl_gen_free() to prevent memory leaks --- caPutLogApp/caPutJsonLogTask.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/caPutLogApp/caPutJsonLogTask.cpp b/caPutLogApp/caPutJsonLogTask.cpp index 31248a1..a9c20c8 100644 --- a/caPutLogApp/caPutJsonLogTask.cpp +++ b/caPutLogApp/caPutJsonLogTask.cpp @@ -377,6 +377,7 @@ void CaPutJsonLogTask::addPutToQueue(LOGDATA * plogData) flag = call; \ if (flag != yajl_gen_status_ok) { \ errlogSevPrintf(errlogMinor, "caPutJsonLog: JSON generation error\n"); \ + yajl_gen_free(handle); \ return caPutJsonLogError; \ } \ } @@ -598,6 +599,7 @@ caPutJsonLogStatus CaPutJsonLogTask::buildJsonMsg(const VALUE *pold_value, const /* First log to a PV so we can append new line later for the logging to a server */ this->logToPV(json); this->logToServer(json.append("\n")); + yajl_gen_free(handle); return caPutJsonLogSuccess; }