fixed memory leaks.

This commit is contained in:
Martin Preuss
2025-03-23 16:58:07 +01:00
parent ebce002614
commit 52eb92a00c
14 changed files with 292 additions and 7 deletions

View File

@@ -120,8 +120,9 @@ int main(int argc, char **argv)
_runService(aqh, eventLoop);
//AqHomeData_Fini(aqh);
AqHomeDataServer_Fini(aqh);
AQH_Object_free(aqh);
AQH_EventLoop_free(eventLoop);
GWEN_Gui_SetGui(NULL);
GWEN_Gui_free(gui);

View File

@@ -126,6 +126,7 @@ void GWENHYWFAR_CB _freeData(GWEN_UNUSED void *bp, void *p)
}
GWEN_DB_Group_free(xo->dbArgs);
AQH_Storage_free(xo->storage);
AQH_MsgRequest_free(xo->requestTree);
free(xo->pidFile);
GWEN_FREE_OBJECT(xo);
@@ -304,6 +305,24 @@ int _setupIpc(AQH_OBJECT *o, AQHOME_SERVER *xo, GWEN_DB_NODE *dbArgs)
/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
* fini
* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
*/
int AqHomeDataServer_Fini(AQH_OBJECT *o)
{
AQHOME_SERVER *xo;
xo=GWEN_INHERIT_GETDATA(AQH_OBJECT, AQHOME_SERVER, o);
if (xo) {
if (xo->pidFile)
remove(xo->pidFile);
}
}
/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
* signal handler
* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

View File

@@ -33,6 +33,7 @@
AQH_OBJECT *AqHomeDataServer_new(AQH_EVENT_LOOP *eventLoop);
int AqHomeDataServer_Init(AQH_OBJECT *o, int argc, char **argv);
int AqHomeDataServer_Fini(AQH_OBJECT *o);
int AqHomeDataServer_GetTimeout(const AQH_OBJECT *o);
int AqHomeDataServer_GetClientNum(const AQH_OBJECT *o);

View File

@@ -130,6 +130,7 @@ int main(int argc, char **argv)
AQH_MqttLogServer_Fini(aqh);
AQH_Object_free(aqh);
AQH_EventLoop_free(eventLoop);
GWEN_Gui_SetGui(NULL);
GWEN_Gui_free(gui);

View File

@@ -156,8 +156,15 @@ void GWENHYWFAR_CB _freeData(GWEN_UNUSED void *bp, void *p)
AQH_Object_free(xo->mqttEndpoint);
AQH_Object_free(xo->brokerEndpoint);
AQHMQTT_Device_List_free(xo->availableDeviceList);
AQHMQTT_Device_List_free(xo->registeredDeviceList);
GWEN_DB_Group_free(xo->dbArgs);
free(xo->deviceFile);
free(xo->pidFile);
free(xo->mqttAddress);
free(xo->mqttClientId);
free(xo->brokerAddress);
free(xo->brokerClientId);
GWEN_FREE_OBJECT(xo);
}

View File

@@ -115,8 +115,9 @@ int main(int argc, char **argv)
_runService(aqh, eventLoop);
//AQH_NodeServer_Fini(aqh);
AQH_NodeServer_Fini(aqh);
AQH_Object_free(aqh);
AQH_EventLoop_free(eventLoop);
GWEN_Gui_SetGui(NULL);
GWEN_Gui_free(gui);

View File

@@ -178,6 +178,9 @@ void GWENHYWFAR_CB _freeData(GWEN_UNUSED void *bp, void *p)
AQH_Object_free(xo->ipcEndpoint);
AQH_Object_free(xo->ttyEndpoint);
AQH_Object_free(xo->brokerEndpoint);
AQHNODE_Device_List_free(xo->deviceDefList);
GWEN_DB_Group_free(xo->dbArgs);
AQH_MsgRequest_free(xo->requestTree);
AQH_NodeDb_free(xo->nodeDb);
free(xo->dbFile);

View File

@@ -161,6 +161,7 @@ int main(int argc, char **argv)
AQH_ReactServer_Fini(aqh);
AQH_Object_free(aqh);
AQH_EventLoop_free(eventLoop);
GWEN_Gui_SetGui(NULL);
GWEN_Gui_free(gui);

View File

@@ -150,7 +150,13 @@ void GWENHYWFAR_CB _freeData(GWEN_UNUSED void *bp, void *p)
xo=(AQH_REACT_SERVER*) p;
AQH_Object_free(xo->brokerEndpoint);
GWEN_DB_Group_free(xo->dbArgs);
free(xo->pidFile);
free(xo->varsFile);
free(xo->brokerAddress);
free(xo->brokerClientId);
AQHREACT_Unit_List_free(xo->unitList);
AQH_Vars_free(xo->localVars);
GWEN_FREE_OBJECT(xo);
}

View File

@@ -46,6 +46,7 @@ void AQHREACT_Unit_free(AQHREACT_UNIT *unit)
GWEN_INHERIT_FINI(AQHREACT_UNIT, unit);
free(unit->typeName);
free(unit->description);
free(unit->id);
AQHREACT_Port_List_free(unit->outputPortList);
AQHREACT_Port_List_free(unit->inputPortList);
AQHREACT_Param_List_free(unit->paramList);

View File

@@ -246,8 +246,12 @@ int _hasDateChanged(AQHREACT_UNIT *unit)
GWEN_DATE *today;
today=GWEN_Date_CurrentDate();
if (GWEN_Date_Compare(today, xunit->date)!=0)
if (GWEN_Date_Compare(today, xunit->date)!=0) {
GWEN_Date_free(today);
return 1;
}
GWEN_Date_free(today);
}
}