Skip to content

Commit

Permalink
Merge pull request #895 from sjinks/patch-1
Browse files Browse the repository at this point in the history
Do not try to dereference a not initialized variable
  • Loading branch information
Phalcon committed Jul 22, 2013
2 parents d57f237 + 236def7 commit 2c02783
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions ext/http/response/headers.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
+------------------------------------------------------------------------+
| Phalcon Framework |
Expand Down Expand Up @@ -136,7 +135,7 @@ PHP_METHOD(Phalcon_Http_Response_Headers, send){
HashTable *ah0;
HashPosition hp0;
zval **hd;
sapi_header_line *ctr;
sapi_header_line ctr = { NULL, 0, 0 };

PHALCON_MM_GROW();

Expand All @@ -152,24 +151,20 @@ PHP_METHOD(Phalcon_Http_Response_Headers, send){
PHALCON_GET_HKEY(header, ah0, hp0);
PHALCON_GET_HVALUE(value);

ctr->line = NULL;
ctr->line_len = 0;
ctr->response_code = 0;

if (PHALCON_IS_NOT_EMPTY(value)) {
PHALCON_INIT_NVAR(http_header);
PHALCON_CONCAT_VSV(http_header, header, ": ", value);
ctr->line = Z_STRVAL_P(http_header);
ctr->line_len = Z_STRLEN_P(http_header);
ctr.line = Z_STRVAL_P(http_header);
ctr.line_len = Z_STRLEN_P(http_header);
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
} else {
zend_make_printable_zval(header, &copy, &use_copy);
if (unlikely(use_copy)) {
header = ©
}

ctr->line = Z_STRVAL_P(header);
ctr->line_len = Z_STRLEN_P(header);
ctr.line = Z_STRVAL_P(header);
ctr.line_len = Z_STRLEN_P(header);
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);

if (unlikely(use_copy)) {
Expand Down

0 comments on commit 2c02783

Please sign in to comment.