summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2011-07-28 10:52:45 +0000
committerPierre Joye <pajoye@php.net>2011-07-28 10:52:45 +0000
commitb3ccd26eb44d0026750eed2e3a47e0ebae8699e6 (patch)
treeed785dc75409f7ebf4a837bf15120f2a917ecf6a
parentd3fd31b6dd36fdad393dcc74fca2d9005b79cd84 (diff)
downloadphp-git-b3ccd26eb44d0026750eed2e3a47e0ebae8699e6.tar.gz
- Fix #55301 (url scanner part) check if malloc succeded
-rw-r--r--ext/standard/url_scanner_ex.c7
-rw-r--r--ext/standard/url_scanner_ex.re8
2 files changed, 11 insertions, 4 deletions
diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
index c5d53f92e7..f33f99a498 100644
--- a/ext/standard/url_scanner_ex.c
+++ b/ext/standard/url_scanner_ex.c
@@ -57,9 +57,12 @@ static PHP_INI_MH(OnUpdateTags)
if (ctx->tags)
zend_hash_destroy(ctx->tags);
- else
+ else {
ctx->tags = malloc(sizeof(HashTable));
-
+ if (!ctx->tags) {
+ return FAILURE;
+ }
+ }
zend_hash_init(ctx->tags, 0, NULL, NULL, 1);
for (key = php_strtok_r(tmp, ",", &lasts);
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index 888bb0667a..e9fc0b5f56 100644
--- a/ext/standard/url_scanner_ex.re
+++ b/ext/standard/url_scanner_ex.re
@@ -55,9 +55,13 @@ static PHP_INI_MH(OnUpdateTags)
if (ctx->tags)
zend_hash_destroy(ctx->tags);
- else
+ else {
ctx->tags = malloc(sizeof(HashTable));
-
+ if (!ctx->tags) {
+ return FAILURE;
+ }
+ }
+
zend_hash_init(ctx->tags, 0, NULL, NULL, 1);
for (key = php_strtok_r(tmp, ",", &lasts);