From bfe4a7f795a4af288ba4fbe12159328fc8eb5fa8 Mon Sep 17 00:00:00 2001 From: vincents Date: Thu, 3 May 2007 07:01:52 +0000 Subject: [PATCH] win32 interface: fixed memleak when showing an open file dialog git-svn-id: trunk@11058 - --- lcl/interfaces/win32/win32wsdialogs.pp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lcl/interfaces/win32/win32wsdialogs.pp b/lcl/interfaces/win32/win32wsdialogs.pp index ed16d8b6b1..750335fd66 100644 --- a/lcl/interfaces/win32/win32wsdialogs.pp +++ b/lcl/interfaces/win32/win32wsdialogs.pp @@ -482,15 +482,16 @@ end; class procedure TWin32WSSaveDialog.DestroyHandle(const ACommonDialog: TCommonDialog); var - OPENFILE: LPOPENFILENAME; + OpenFile: LPOPENFILENAME; begin if ACommonDialog.Handle <> 0 then begin - OPENFILE := LPOPENFILENAME(ACommonDialog.Handle); - if OPENFILE^.lCustData <> 0 then + OpenFile := LPOPENFILENAME(ACommonDialog.Handle); + if OpenFile^.lCustData <> 0 then Dispose(POpenFileDialogRec(OPENFILE^.lCustData)); StrDispose(OpenFile^.lpStrFilter); FreeMem(OpenFile^.lpStrFile); + FreeMem(OpenFile); end; end; @@ -519,6 +520,7 @@ begin Dispose(POpenFileDialogRec(OPENFILE^.lCustData)); StrDispose(OpenFile^.lpStrFilter); FreeMem(OpenFile^.lpStrFile); + FreeMem(OpenFile); end; end;