mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
fixed some memory leaks with GetClassInfoEx(A/W)
svn path=/trunk/; revision=5665
This commit is contained in:
parent
b46260a736
commit
b3b09803f9
1 changed files with 66 additions and 53 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: class.c,v 1.33 2003/08/19 01:03:41 weiden Exp $
|
||||
/* $Id: class.c,v 1.34 2003/08/19 02:55:53 royce Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS user32.dll
|
||||
|
@ -41,20 +41,23 @@ GetClassInfoExA(
|
|||
if(IS_ATOM(lpszClass))
|
||||
str = (LPWSTR)lpszClass;
|
||||
else
|
||||
{
|
||||
Status = HEAP_strdupAtoW (&str, lpszClass, NULL);
|
||||
if ( !NT_SUCCESS (Status) )
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError(Status));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
str2.Length = 0;
|
||||
str2.MaximumLength = 255;
|
||||
str2.Buffer = (PWSTR)RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
||||
str2.MaximumLength * sizeof(WCHAR));
|
||||
str2.Buffer = (PWSTR)HEAP_alloc ( str2.MaximumLength * sizeof(WCHAR) );
|
||||
if ( !str2.Buffer )
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY));
|
||||
if ( !IS_ATOM(str) )
|
||||
HEAP_free ( str );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -68,7 +71,8 @@ GetClassInfoExA(
|
|||
{
|
||||
lpwcx->lpszMenuName = heap_string_poolA ( str2.Buffer, str2.Length );
|
||||
}
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, str2.Buffer);
|
||||
HEAP_free ( str2.Buffer );
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -97,15 +101,23 @@ GetClassInfoExW(
|
|||
if(IS_ATOM(lpszClass))
|
||||
str = (LPWSTR)lpszClass;
|
||||
else
|
||||
{
|
||||
str = HEAP_strdupW ( lpszClass, wcslen(lpszClass) );
|
||||
if ( !str )
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
str2.Length = 0;
|
||||
str2.MaximumLength = 255;
|
||||
str2.Buffer = (PWSTR)RtlAllocateHeap(RtlGetProcessHeap(), 0,
|
||||
str2.MaximumLength * sizeof(WCHAR));
|
||||
str2.Buffer = (PWSTR)HEAP_alloc ( str2.MaximumLength * sizeof(WCHAR) );
|
||||
if ( !str2.Buffer )
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY));
|
||||
if ( !IS_ATOM(str) )
|
||||
HEAP_free ( str );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -120,7 +132,8 @@ GetClassInfoExW(
|
|||
lpwcx->lpszMenuName = heap_string_poolW ( str2.Buffer, str2.Length );
|
||||
}
|
||||
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, str2.Buffer);
|
||||
HEAP_free ( str2.Buffer );
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue