From 7efb0a14f435e4ffb7ffc8f502ca07ec1d6872a1 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Mon, 25 Dec 2006 21:41:04 +0000 Subject: Use safe_emalloc() --- ext/json/json.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/json/json.c') diff --git a/ext/json/json.c b/ext/json/json.c index 84d5aa056c..470a90d440 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -242,7 +242,7 @@ static void json_escape_string(smart_str *buf, char *s, int len) return; } - utf16 = (unsigned short *) emalloc(len * sizeof(unsigned short)); + utf16 = (unsigned short *) safe_emalloc(len, sizeof(unsigned short), 0); len = utf8_to_utf16(utf16, s, len); if (len <= 0) @@ -421,7 +421,7 @@ static PHP_FUNCTION(json_decode) RETURN_NULL(); } - utf16 = (unsigned short *) emalloc((parameter_len+1) * sizeof(unsigned short)); + utf16 = (unsigned short *) safe_emalloc((parameter_len+1), sizeof(unsigned short), 1); utf16_len = utf8_to_utf16(utf16, parameter, parameter_len); if (utf16_len <= 0) -- cgit v1.2.1