one more error handling fix for GetTimeFormatA()

svn path=/trunk/; revision=9093
This commit is contained in:
Martin Fuchs 2004-04-12 10:49:48 +00:00
parent a46eec6cea
commit bdc459faa9

View file

@ -1,4 +1,4 @@
/* $Id: lang.c,v 1.13 2004/04/12 10:19:43 mf Exp $ /* $Id: lang.c,v 1.14 2004/04/12 10:49:48 mf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT : ReactOS user mode libraries * PROJECT : ReactOS user mode libraries
@ -1320,7 +1320,7 @@ GetTimeFormatA (
LPWSTR lpFormatU = NULL; LPWSTR lpFormatU = NULL;
LPWSTR lpTimeStrU; LPWSTR lpTimeStrU;
int numCharsU; int numCharsU;
int retVal; int retVal = 0;
if (lpFormat != NULL) { if (lpFormat != NULL) {
/* First just determine the number of necessary bytes /* First just determine the number of necessary bytes
@ -1352,12 +1352,7 @@ GetTimeFormatA (
Unicode output */ Unicode output */
numCharsU = GetTimeFormatW(Locale,dwFlags,lpTime,lpFormatU,NULL,0); numCharsU = GetTimeFormatW(Locale,dwFlags,lpTime,lpFormatU,NULL,0);
if (numCharsU == 0) { if (numCharsU != 0) {
if (lpFormatU != NULL)
HeapFree(GetProcessHeap(),0,lpFormatU);
return 0;
}
lpTimeStrU = HeapAlloc(GetProcessHeap(),0,numCharsU*sizeof(WCHAR)); lpTimeStrU = HeapAlloc(GetProcessHeap(),0,numCharsU*sizeof(WCHAR));
if (lpTimeStrU == NULL) { if (lpTimeStrU == NULL) {
if (lpFormatU != NULL) if (lpFormatU != NULL)
@ -1377,6 +1372,8 @@ GetTimeFormatA (
NULL); NULL);
HeapFree(GetProcessHeap(),0,lpTimeStrU); HeapFree(GetProcessHeap(),0,lpTimeStrU);
}
if (lpFormatU != NULL) if (lpFormatU != NULL)
HeapFree(GetProcessHeap(),0,lpFormatU); HeapFree(GetProcessHeap(),0,lpFormatU);