Skip to content

Commit

Permalink
fix memleak and possible segfault in HTTP fopen wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
tony2001 committed Aug 4, 2009
1 parent 1f4ba45 commit cebcb49
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ext/standard/http_fopen_wrapper.c
Expand Up @@ -347,7 +347,10 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
}
smart_str_0(&tmpstr);
/* Remove newlines and spaces from start and end. there's at least one extra \r\n at the end that needs to go. */
tmp = php_trim(tmpstr.c, strlen(tmpstr.c), NULL, 0, NULL, 3 TSRMLS_CC);
if (tmpstr.c) {
tmp = php_trim(tmpstr.c, strlen(tmpstr.c), NULL, 0, NULL, 3 TSRMLS_CC);
smart_str_free(&tmpstr);
}
}
if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval)) {
/* Remove newlines and spaces from start and end php_trim will estrndup() */
Expand Down

0 comments on commit cebcb49

Please sign in to comment.