Skip to content

Commit bd91ee6

Browse files
committed
Fix memory leak
1 parent e9f0a71 commit bd91ee6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ext/standard/http_fopen_wrapper.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,6 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
750750
/* auth header if it was specified */
751751
if (((have_header & HTTP_HEADER_AUTH) == 0) && resource->user) {
752752
smart_str scratch = {0};
753-
zend_string *stmp;
754753

755754
/* decode the strings first */
756755
php_url_decode(ZSTR_VAL(resource->user), ZSTR_LEN(resource->user));
@@ -765,16 +764,16 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
765764
}
766765

767766
zend_string *scratch_str = smart_str_extract(&scratch);
768-
stmp = php_base64_encode((unsigned char*)ZSTR_VAL(scratch_str), ZSTR_LEN(scratch_str));
767+
zend_string *stmp = php_base64_encode((unsigned char*)ZSTR_VAL(scratch_str), ZSTR_LEN(scratch_str));
769768

770769
smart_str_appends(&req_buf, "Authorization: Basic ");
771770
smart_str_append(&req_buf, stmp);
772771
smart_str_appends(&req_buf, "\r\n");
773772

774773
php_stream_notify_info(context, PHP_STREAM_NOTIFY_AUTH_REQUIRED, NULL, 0);
775774

775+
zend_string_efree(scratch_str);
776776
zend_string_free(stmp);
777-
smart_str_free(&scratch);
778777
}
779778

780779
/* if the user has configured who they are, send a From: line */

0 commit comments

Comments
 (0)