You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-06-20 01:17:49 +02:00
Fix issue with calling lstClear() twice.
The list pointer was not nulled out so calling lstClear() caused a double free. This is not a production issue but was noticed in some upcoming test code.
This commit is contained in:
@@ -66,6 +66,7 @@ lstClear(List *const this)
|
||||
}
|
||||
MEM_CONTEXT_END();
|
||||
|
||||
this->pub.list = NULL;
|
||||
this->pub.listSize = 0;
|
||||
this->listSizeMax = 0;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ testRun(void)
|
||||
TEST_RESULT_Z(logBuf, "{size: 1}", "check log");
|
||||
|
||||
TEST_RESULT_VOID(lstClear(list), "clear list");
|
||||
TEST_RESULT_VOID(lstClear(list), "clear list again to ensure everything was cleared correctly");
|
||||
TEST_RESULT_VOID(FUNCTION_LOG_OBJECT_FORMAT(list, lstToLog, logBuf, sizeof(logBuf)), "bufToLog");
|
||||
TEST_RESULT_Z(logBuf, "{size: 0}", "check log");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user