mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-10 13:39:14 +02:00
FreeType: fixed code mess and memory leak in ttcache. Patch by lagprogramming. issue #40202
This commit is contained in:
parent
d9a5787be8
commit
602fb83512
@ -298,7 +298,7 @@ var
|
|||||||
label
|
label
|
||||||
Fail;
|
Fail;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
//Result := False;
|
||||||
(* LOCK *)
|
(* LOCK *)
|
||||||
current := cache.idle;
|
current := cache.idle;
|
||||||
if current <> nil then
|
if current <> nil then
|
||||||
@ -312,7 +312,9 @@ var
|
|||||||
begin
|
begin
|
||||||
(* if no object was found in the cache, create a new one *)
|
(* if no object was found in the cache, create a new one *)
|
||||||
obj:=nil;
|
obj:=nil;
|
||||||
if Alloc( obj, cache.clazz^.object_size ) then exit;
|
|
||||||
|
if Alloc( obj, cache.clazz^.object_size ) then
|
||||||
|
goto Fail;
|
||||||
|
|
||||||
current := Element_New;
|
current := Element_New;
|
||||||
if current = nil then goto Fail;
|
if current = nil then goto Fail;
|
||||||
@ -320,7 +322,11 @@ var
|
|||||||
current^.data := obj;
|
current^.data := obj;
|
||||||
|
|
||||||
error := cache.clazz^.init( obj, parent_data );
|
error := cache.clazz^.init( obj, parent_data );
|
||||||
if error then goto Fail;
|
if error then
|
||||||
|
begin
|
||||||
|
Element_Done( current );
|
||||||
|
goto Fail;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(* LOCK *)
|
(* LOCK *)
|
||||||
|
Loading…
Reference in New Issue
Block a user