projects
/
m6w6
/
ext-http
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (parent:
d7f91cd
)
alloca
author
Michael Wallner
<mike@php.net>
Tue, 29 Jul 2014 18:37:00 +0000
(20:37 +0200)
committer
Michael Wallner
<mike@php.net>
Tue, 29 Jul 2014 18:37:00 +0000
(20:37 +0200)
php_http_message.c
patch
|
blob
|
history
diff --git
a/php_http_message.c
b/php_http_message.c
index 9432ae953f7c7a8fd5e2bce46401fd080f207628..cc04edcf3850285742935ce626e74b76fdb816ef 100644
(file)
--- a/
php_http_message.c
+++ b/
php_http_message.c
@@
-149,7
+149,13
@@
php_http_message_t *php_http_message_parse(php_http_message_t *msg, const char *
zval *php_http_message_header(php_http_message_t *msg, const char *key_str, size_t key_len, int join)
{
zval *ret = NULL, **header;
zval *php_http_message_header(php_http_message_t *msg, const char *key_str, size_t key_len, int join)
{
zval *ret = NULL, **header;
- char *key = php_http_pretty_key(estrndup(key_str, key_len), key_len, 1, 1);
+ char *key;
+ ALLOCA_FLAG(free_key);
+
+ key = do_alloca(key_len + 1, free_key);
+ memcpy(key, key_str, key_len);
+ key[key_len] = '\0';
+ php_http_pretty_key(key, key_len, 1, 1);
if (SUCCESS == zend_symtable_find(&msg->hdrs, key, key_len + 1, (void *) &header)) {
if (join && Z_TYPE_PP(header) == IS_ARRAY) {
if (SUCCESS == zend_symtable_find(&msg->hdrs, key, key_len + 1, (void *) &header)) {
if (join && Z_TYPE_PP(header) == IS_ARRAY) {
@@
-162,7
+168,7
@@
zval *php_http_message_header(php_http_message_t *msg, const char *key_str, size
}
}
}
}
-
efree(
key);
+
free_alloca(key, free_
key);
return ret;
}
return ret;
}