GIT
/
REPO
/
FRED-BOY
Projects
/
d2df-sdl.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
26a9499
)
fixed small memory leak in archive reader
author
Ketmar Dark <ketmar@ketmar.no-ip.org>
Fri, 8 Apr 2016 19:34:50 +0000
(22:34 +0300)
committer
Ketmar Dark <ketmar@ketmar.no-ip.org>
Fri, 8 Apr 2016 19:34:50 +0000
(22:34 +0300)
src/shared/WADEDITOR.pas
patch
|
blob
|
history
diff --git
a/src/shared/WADEDITOR.pas
b/src/shared/WADEDITOR.pas
index de670694b81fe44207506b355c7351b3921ea86c..0a80f51d4d43091f3be64900719c3180a498e588 100644
(file)
--- a/
src/shared/WADEDITOR.pas
+++ b/
src/shared/WADEDITOR.pas
@@
-157,6
+157,7
@@
var
f: Integer;
fi: TSFSFileInfo;
fs: TStream;
+ fpp: Pointer;
//fn: string;
begin
Result := False;
@@
-186,8
+187,19
@@
begin
end;
Len := Integer(fs.size);
GetMem(pData, Len);
- fs.ReadBuffer(pData^, Len);
- fs.Free;
+ fpp := pData;
+ try
+ fs.ReadBuffer(pData^, Len);
+ fpp := nil;
+ finally
+ if fpp <> nil then
+ begin
+ FreeMem(fpp);
+ pData := nil;
+ Len := 0;
+ end;
+ fs.Free;
+ end;
result := true;
{$IFDEF SFS_DWFAD_DEBUG}
if gSFSDebug then
DEADSOFTWARE 2012-2025