mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
Avoid possible memory leak in the URL scanner, if the connection is
interrupted during writing the output.
This commit is contained in:
parent
8d5d20500b
commit
7eb8469679
4 changed files with 3 additions and 21 deletions
|
@ -361,10 +361,6 @@ static int php_ub_body_write_no_header(const char *str, uint str_length)
|
|||
|
||||
result = OG(php_header_write)(str, str_length);
|
||||
|
||||
if (newstr) {
|
||||
free(newstr);
|
||||
}
|
||||
|
||||
if (OG(implicit_flush)) {
|
||||
sapi_flush();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by re2c 0.5 on Fri Dec 22 23:45:29 2000 */
|
||||
/* Generated by re2c 0.5 on Tue Jan 9 17:13:20 2001 */
|
||||
#line 1 "/home/sas/src/php4/ext/standard/url_scanner_ex.re"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
|
@ -691,14 +691,9 @@ char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char
|
|||
mainloop(ctx, src, srclen);
|
||||
|
||||
*newlen = ctx->result.len;
|
||||
if (ctx->result.len == 0) {
|
||||
return strdup("");
|
||||
}
|
||||
smart_str_0(&ctx->result);
|
||||
ret = malloc(ctx->result.len + 1);
|
||||
memcpy(ret, ctx->result.c, ctx->result.len + 1);
|
||||
ctx->result.len = 0;
|
||||
return ret;
|
||||
return ctx->result.c;
|
||||
}
|
||||
|
||||
PHP_RINIT_FUNCTION(url_scanner)
|
||||
|
|
|
@ -334,14 +334,9 @@ char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char
|
|||
mainloop(ctx, src, srclen);
|
||||
|
||||
*newlen = ctx->result.len;
|
||||
if (ctx->result.len == 0) {
|
||||
return strdup("");
|
||||
}
|
||||
smart_str_0(&ctx->result);
|
||||
ret = malloc(ctx->result.len + 1);
|
||||
memcpy(ret, ctx->result.c, ctx->result.len + 1);
|
||||
ctx->result.len = 0;
|
||||
return ret;
|
||||
return ctx->result.c;
|
||||
}
|
||||
|
||||
PHP_RINIT_FUNCTION(url_scanner)
|
||||
|
|
|
@ -361,10 +361,6 @@ static int php_ub_body_write_no_header(const char *str, uint str_length)
|
|||
|
||||
result = OG(php_header_write)(str, str_length);
|
||||
|
||||
if (newstr) {
|
||||
free(newstr);
|
||||
}
|
||||
|
||||
if (OG(implicit_flush)) {
|
||||
sapi_flush();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue