From eab254d6dca1c55d441a48448bdcc8ef090820bc Mon Sep 17 00:00:00 2001 From: Andre Leiradella Date: Mon, 19 Oct 2015 14:57:05 -0200 Subject: [PATCH] check malloc result --- cheevos.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cheevos.c b/cheevos.c index 09da2dc8b5..72de7d4037 100644 --- a/cheevos.c +++ b/cheevos.c @@ -1175,8 +1175,12 @@ error1: if ( data ) { result = (char*)malloc( length + 1 ); - memcpy( (void*)result, (void*)data, length ); - result[ length ] = 0; + + if ( result ) + { + memcpy( (void*)result, (void*)data, length ); + result[ length ] = 0; + } } else {