mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 04:13:34 +00:00
Fix possible memory leak in ProbeAndCaptureUnicodeString
Patch from Thomas Weidenmueller svn path=/trunk/; revision=22078
This commit is contained in:
@@ -31,7 +31,7 @@ VOID NTAPI W32kRaiseStatus(NTSTATUS Status);
|
||||
|
||||
#define ProbeForWriteBoolean(Ptr) ProbeForWriteGenericType(Ptr, BOOLEAN)
|
||||
#define ProbeForWriteUchar(Ptr) ProbeForWriteGenericType(Ptr, UCHAR)
|
||||
#define ProbeForWriteChar(Ptr) ProbeForWriteGenericType(Ptr, Char)
|
||||
#define ProbeForWriteChar(Ptr) ProbeForWriteGenericType(Ptr, CHAR)
|
||||
#define ProbeForWriteUshort(Ptr) ProbeForWriteGenericType(Ptr, USHORT)
|
||||
#define ProbeForWriteShort(Ptr) ProbeForWriteGenericType(Ptr, SHORT)
|
||||
#define ProbeForWriteUlong(Ptr) ProbeForWriteGenericType(Ptr, ULONG)
|
||||
@@ -85,7 +85,7 @@ ProbeAndCaptureUnicodeString(OUT PUNICODE_STRING Dest,
|
||||
IN PUNICODE_STRING UnsafeSrc)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
WCHAR *Buffer;
|
||||
WCHAR *Buffer = NULL;
|
||||
ASSERT(Dest != NULL);
|
||||
|
||||
/* Probe the structure and buffer*/
|
||||
@@ -136,6 +136,16 @@ ProbeAndCaptureUnicodeString(OUT PUNICODE_STRING Dest,
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
/* Free allocated resources and zero the destination string */
|
||||
if (Buffer != NULL)
|
||||
{
|
||||
ExFreePool(Buffer);
|
||||
}
|
||||
Dest->Length = 0;
|
||||
Dest->MaximumLength = 0;
|
||||
Dest->Buffer = NULL;
|
||||
|
||||
/* Return the error code */
|
||||
Status = _SEH_GetExceptionCode();
|
||||
}
|
||||
_SEH_END;
|
||||
|
||||
Reference in New Issue
Block a user