diff --git a/rtl/objpas/sysutils/sysutilh.inc b/rtl/objpas/sysutils/sysutilh.inc index 18019c21e6..34fdf9e812 100644 --- a/rtl/objpas/sysutils/sysutilh.inc +++ b/rtl/objpas/sysutils/sysutilh.inc @@ -216,6 +216,12 @@ type EArgumentOutOfRangeException = class(EArgumentException); EArgumentNilException = class(EArgumentException); + EPathTooLongException = class(Exception); + ENotSupportedException = class(Exception); + EDirectoryNotFoundException = class(Exception); + EFileNotFoundException = class(Exception); + EPathNotFoundException = class(Exception); + ENoConstructException = class(Exception); { Exception handling routines } @@ -312,6 +318,7 @@ Type {$i syshelph.inc} procedure FreeAndNil(var obj); + procedure FreeMemAndNil(var p); { interface handling } {$i intfh.inc} diff --git a/rtl/objpas/sysutils/sysutils.inc b/rtl/objpas/sysutils/sysutils.inc index 5950610d7b..69fcb2ff76 100644 --- a/rtl/objpas/sysutils/sysutils.inc +++ b/rtl/objpas/sysutils/sysutils.inc @@ -160,7 +160,16 @@ end; temp.free; end; - + procedure FreeMemAndNil(var p); + + var + temp:Pointer; + begin + temp := Pointer(p); + Pointer(P):=nil; + FreeMem(temp); + end; + { Interfaces support } {$i sysuintf.inc} diff --git a/rtl/win/sysutils.pp b/rtl/win/sysutils.pp index 4f456e2e37..10c3973a09 100644 --- a/rtl/win/sysutils.pp +++ b/rtl/win/sysutils.pp @@ -990,7 +990,7 @@ begin MaxMsgSize, { Maximum message size } nil); SysErrorMessage := MsgBuffer; - FreeMem(MsgBuffer, MaxMsgSize); + FreeMem(MsgBuffer, MaxMsgSize*2); end; {****************************************************************************