forked from Telodendria/Telodendria
Fix double-free in UiaCleanup().
This commit is contained in:
parent
2bbe13aaf0
commit
5431c2cd90
1 changed files with 4 additions and 3 deletions
|
@ -493,6 +493,8 @@ UiaCleanup(MatrixHttpHandlerArgs * args)
|
||||||
|
|
||||||
unsigned long lastAccess;
|
unsigned long lastAccess;
|
||||||
|
|
||||||
|
Log(LOG_DEBUG, "Looking at session %s", session);
|
||||||
|
|
||||||
if (!ref)
|
if (!ref)
|
||||||
{
|
{
|
||||||
Log(LOG_ERR, "Unable to lock uia %s for inspection.",
|
Log(LOG_ERR, "Unable to lock uia %s for inspection.",
|
||||||
|
@ -502,16 +504,15 @@ UiaCleanup(MatrixHttpHandlerArgs * args)
|
||||||
|
|
||||||
lastAccess = JsonValueAsInteger(HashMapGet(DbJson(ref), "last_access"));
|
lastAccess = JsonValueAsInteger(HashMapGet(DbJson(ref), "last_access"));
|
||||||
|
|
||||||
|
DbUnlock(args->db, ref);
|
||||||
|
|
||||||
/* If last access was greater than 15 minutes ago, remove this
|
/* If last access was greater than 15 minutes ago, remove this
|
||||||
* session */
|
* session */
|
||||||
if (UtilServerTs() - lastAccess > 1000 * 60 * 15)
|
if (UtilServerTs() - lastAccess > 1000 * 60 * 15)
|
||||||
{
|
{
|
||||||
DbUnlock(args->db, ref);
|
|
||||||
DbDelete(args->db, 2, "user_interactive", session);
|
DbDelete(args->db, 2, "user_interactive", session);
|
||||||
Log(LOG_DEBUG, "Deleted session %s", session);
|
Log(LOG_DEBUG, "Deleted session %s", session);
|
||||||
}
|
}
|
||||||
|
|
||||||
DbUnlock(args->db, ref);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DbListFree(sessions);
|
DbListFree(sessions);
|
||||||
|
|
Loading…
Reference in a new issue