Added handling of timeout cmd arg for valgrind test. fixed memory leaks.

This commit is contained in:
Martin Preuss
2023-10-05 23:56:53 +02:00
parent b66f3d2ef4
commit 8613fbdad7
12 changed files with 123 additions and 6 deletions

View File

@@ -190,10 +190,14 @@ int _doWatch(GWEN_DB_NODE *dbArgs)
void _awaitAndPrintChanges(GWEN_MSG_ENDPOINT *epTcp, int timeoutInSeconds, const char *tmpl)
{
time_t tStart;
tStart=time(NULL);
for (;;) {
GWEN_MSG *msg;
msg=Utils_WaitForSpecificIpcMessage(epTcp, AQH_MSGTYPE_IPC_DATA_DATACHANGED, timeoutInSeconds);
msg=Utils_WaitForSpecificIpcMessage(epTcp, AQH_MSGTYPE_IPC_DATA_DATACHANGED, 2);
if (msg) {
uint16_t code;
@@ -207,6 +211,15 @@ void _awaitAndPrintChanges(GWEN_MSG_ENDPOINT *epTcp, int timeoutInSeconds, const
GWEN_Msg_free(msg);
}
}
if (timeoutInSeconds) {
time_t now;
now=time(NULL);
if ((int)(difftime(now, tStart))>=timeoutInSeconds) {
DBG_INFO(NULL, "Timeout");
break;
}
}
} /* for */
}

View File

@@ -163,9 +163,15 @@ int main(int argc, char **argv)
rv=1;
}
GWEN_Fini();
GWEN_DB_Group_free(dbArgs);
AQH_Fini();
GWEN_Gui_SetGui(NULL);
GWEN_Gui_free(gui);
GWEN_Fini();
return rv;
}