summaryrefslogtreecommitdiff
path: root/ext/json/json.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-12-25 21:41:04 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-12-25 21:41:04 +0000
commit7efb0a14f435e4ffb7ffc8f502ca07ec1d6872a1 (patch)
tree10139a1c36124c4d47360d48abea996b624979de /ext/json/json.c
parent807a0966a9dcf37614100842d313ee96f5977391 (diff)
downloadphp-git-7efb0a14f435e4ffb7ffc8f502ca07ec1d6872a1.tar.gz
Use safe_emalloc()
Diffstat (limited to 'ext/json/json.c')
-rw-r--r--ext/json/json.c4
1 files changed, 2 insertions, 2 deletions
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)