* use a try..finally block to protect against memory leaks if the comparison

callback function raises an exception in QuickSort_ItemList_Context

git-svn-id: trunk@41228 -
This commit is contained in:
nickysn 2019-02-05 12:14:09 +00:00
parent e5492d8992
commit de80621e1e

View File

@ -237,8 +237,11 @@ begin
if not Assigned(Items) or (ItemCount < 2) or (ItemSize < 1) then
exit;
GetMem(TempBuf, ItemSize);
QuickSort(0, ItemCount - 1);
FreeMem(TempBuf, ItemSize);
try
QuickSort(0, ItemCount - 1);
finally
FreeMem(TempBuf, ItemSize);
end;
end;
procedure QuickSort_ItemList_CustomItemExchanger_Context(