ntdll: Handle error if RtlAllocateHeap fails in printf functions.

This commit is contained in:
Sebastian Lackner 2013-12-20 05:55:34 +01:00 committed by Alexandre Julliard
parent 661212b5f5
commit 29de7dd60b
1 changed files with 11 additions and 3 deletions

View File

@ -300,7 +300,13 @@ static void pf_integer_conv( char *buf, int buf_len, pf_flags *flags,
char number[40], *tmp = number; char number[40], *tmp = number;
if( buf_len > sizeof number ) if( buf_len > sizeof number )
tmp = RtlAllocateHeap( GetProcessHeap(), 0, buf_len ); {
if (!(tmp = RtlAllocateHeap( GetProcessHeap(), 0, buf_len )))
{
buf[0] = '\0';
return;
}
}
base = 10; base = 10;
if( flags->Format == 'o' ) if( flags->Format == 'o' )
@ -588,7 +594,8 @@ static int pf_vsnprintf( pf_output *out, const WCHAR *format, __ms_va_list valis
flags.FieldLength : flags.Precision) + 10; flags.FieldLength : flags.Precision) + 10;
if( x_len >= sizeof number) if( x_len >= sizeof number)
x = RtlAllocateHeap( GetProcessHeap(), 0, x_len ); if (!(x = RtlAllocateHeap( GetProcessHeap(), 0, x_len )))
return -1;
pf_integer_conv( x, x_len, &flags, va_arg(valist, LONGLONG) ); pf_integer_conv( x, x_len, &flags, va_arg(valist, LONGLONG) );
@ -611,7 +618,8 @@ static int pf_vsnprintf( pf_output *out, const WCHAR *format, __ms_va_list valis
flags.FieldLength : flags.Precision) + 10; flags.FieldLength : flags.Precision) + 10;
if( x_len >= sizeof number) if( x_len >= sizeof number)
x = RtlAllocateHeap( GetProcessHeap(), 0, x_len ); if (!(x = RtlAllocateHeap( GetProcessHeap(), 0, x_len )))
return -1;
pf_rebuild_format_string( fmt, &flags ); pf_rebuild_format_string( fmt, &flags );