From 50886df6117d137d76033912c5150c17790ba759 Mon Sep 17 00:00:00 2001 From: Netaji Panigrahi <114923459+NetajiPanigrahi@users.noreply.github.com> Date: Mon, 18 Nov 2024 15:57:34 +0530 Subject: [PATCH] Update rbus_subscriptions.c --- src/rbus/rbus_subscriptions.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rbus/rbus_subscriptions.c b/src/rbus/rbus_subscriptions.c index 5e6636de..8f88996c 100644 --- a/src/rbus/rbus_subscriptions.c +++ b/src/rbus/rbus_subscriptions.c @@ -621,7 +621,7 @@ static void rbusSubscriptions_loadCache(rbusSubscriptions_t subscriptions) rbusBuffer_Destroy(buff); if(sub) - free(sub); + subscriptionFree(sub); if(remove(filePath) != 0) RBUSLOG_ERROR("failed to remove %s", filePath); @@ -665,7 +665,11 @@ static void rbusSubscriptions_saveCache(rbusSubscriptions_t subscriptions) { rtListItem_GetData(item, (void**)&sub); if(!sub) + { + rbusBuffer_Destroy(buff); + fclose(file); return; + } rbusBuffer_WriteStringTLV(buff, sub->listener, strlen(sub->listener)+1); rbusBuffer_WriteStringTLV(buff, sub->eventName, strlen(sub->eventName)+1); rbusBuffer_WriteInt32TLV(buff, sub->componentId);