check malloc result

This commit is contained in:
Andre Leiradella 2015-10-19 14:57:05 -02:00
parent 1ff3b58d68
commit eab254d6dc
1 changed files with 6 additions and 2 deletions

View File

@ -1175,9 +1175,13 @@ error1:
if ( data ) if ( data )
{ {
result = (char*)malloc( length + 1 ); result = (char*)malloc( length + 1 );
if ( result )
{
memcpy( (void*)result, (void*)data, length ); memcpy( (void*)result, (void*)data, length );
result[ length ] = 0; result[ length ] = 0;
} }
}
else else
{ {
result = NULL; result = NULL;