diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5d6a2ed6b1..849b188a68 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,9 @@ +20000427-20:40 GMT+1 Ryszard Glab + + *source/compiler/harbour.c + * changed hb_xgrab/hb_xrealloc to use sprintf in case + unsuccessfull allocation only + 20000426 23:30 Luiz Rafael Culik !ChangeLog *Renamed ChangeLog to ChangeLog.007 and started a new one diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index e48bd17dfa..749167577d 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -339,12 +339,14 @@ int isatty( int handle ) void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exits on failure */ { void * pMem = malloc( ulSize ); - char szSize [10]; - - sprintf( szSize, "%li", ulSize ); if( ! pMem ) + { + char szSize[ 32 ]; + + sprintf( szSize, "%li", ulSize ); hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_MEMALLOC, szSize, NULL ); + } return pMem; } @@ -352,13 +354,14 @@ void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exits on fail void * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates memory */ { void * pResult = realloc( pMem, ulSize ); - char szSize [10]; - - sprintf( szSize, "%li", ulSize ); - if( ! pResult ) - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_MEMREALLOC, szSize, NULL ); + { + char szSize[ 32 ]; + sprintf( szSize, "%li", ulSize ); + hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_MEMREALLOC, szSize, NULL ); + } + return pResult; }