Skip to content

Commit 716ae7b

Browse files
author
pajoye
committed
- Fix #55301 (url scanner part) check if malloc succeded
git-svn-id: http://svn.php.net/repository/php/php-src/trunk@313832 c90b9560-bf6c-de11-be94-00142212c4b1
1 parent 93eda6a commit 716ae7b

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

ext/standard/url_scanner_ex.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ static PHP_INI_MH(OnUpdateTags)
5757

5858
if (ctx->tags)
5959
zend_hash_destroy(ctx->tags);
60-
else
60+
else {
6161
ctx->tags = malloc(sizeof(HashTable));
62-
62+
if (!ctx->tags) {
63+
return FAILURE;
64+
}
65+
}
6366
zend_hash_init(ctx->tags, 0, NULL, NULL, 1);
6467

6568
for (key = php_strtok_r(tmp, ",", &lasts);

ext/standard/url_scanner_ex.re

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,13 @@ static PHP_INI_MH(OnUpdateTags)
5555

5656
if (ctx->tags)
5757
zend_hash_destroy(ctx->tags);
58-
else
58+
else {
5959
ctx->tags = malloc(sizeof(HashTable));
60-
60+
if (!ctx->tags) {
61+
return FAILURE;
62+
}
63+
}
64+
6165
zend_hash_init(ctx->tags, 0, NULL, NULL, 1);
6266

6367
for (key = php_strtok_r(tmp, ",", &lasts);

0 commit comments

Comments
 (0)