cvs: php4 /ext/standard output.c url_scanner_ex.c url_scanner_ex.re

From: Date: Tue, 09 Jan 2001 16:45:19 +0000
Subject: cvs: php4 /ext/standard output.c url_scanner_ex.c url_scanner_ex.re
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-3517@lists.php.net to get a copy of this message
sas Tue Jan 9 08:45:19 2001 EDT Modified files: /php4/ext/standard output.c url_scanner_ex.c url_scanner_ex.re Log: Avoid possible memory leak in the URL scanner, if the connection is interrupted during writing the output. Index: php4/ext/standard/output.c diff -u php4/ext/standard/output.c:1.37 php4/ext/standard/output.c:1.38 --- php4/ext/standard/output.c:1.37 Thu Nov 23 10:43:18 2000 +++ php4/ext/standard/output.c Tue Jan 9 08:45:18 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: output.c,v 1.37 2000/11/23 18:43:18 zeev Exp $ */ +/* $Id: output.c,v 1.38 2001/01/09 16:45:18 sas Exp $ */ #include "php.h" #include "ext/standard/head.h" @@ -360,10 +360,6 @@ } result = OG(php_header_write)(str, str_length); - - if (newstr) { - free(newstr); - } if (OG(implicit_flush)) { sapi_flush(); Index: php4/ext/standard/url_scanner_ex.c diff -u php4/ext/standard/url_scanner_ex.c:1.27 php4/ext/standard/url_scanner_ex.c:1.28 --- php4/ext/standard/url_scanner_ex.c:1.27 Tue Jan 2 12:39:27 2001 +++ php4/ext/standard/url_scanner_ex.c Tue Jan 9 08:45:18 2001 @@ -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 @@ 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) Index: php4/ext/standard/url_scanner_ex.re diff -u php4/ext/standard/url_scanner_ex.re:1.28 php4/ext/standard/url_scanner_ex.re:1.29 --- php4/ext/standard/url_scanner_ex.re:1.28 Tue Jan 2 12:39:27 2001 +++ php4/ext/standard/url_scanner_ex.re Tue Jan 9 08:45:19 2001 @@ -334,14 +334,9 @@ 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)

« previous php.cvs (#3517) next »