]> granicus.if.org Git - php/commitdiff
Avoid possible memory leak in the URL scanner, if the connection is
authorSascha Schumann <sas@php.net>
Tue, 9 Jan 2001 16:45:19 +0000 (16:45 +0000)
committerSascha Schumann <sas@php.net>
Tue, 9 Jan 2001 16:45:19 +0000 (16:45 +0000)
interrupted during writing the output.

ext/standard/output.c
ext/standard/url_scanner_ex.c
ext/standard/url_scanner_ex.re
main/output.c

index 88f74b57f05e5bd5aae31f3cc4d2b10205d19853..970917558d4f1946d90400bfc100e8f774415214 100644 (file)
@@ -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();
        }
index e7becb5c3c308dcefff09ef9f24b4adbde60d375..766c85c90cddfdad911d277c1f081e50bcd9ebfa 100644 (file)
@@ -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)
index 30606580973aaf520d61d6dcc4742e725bdafaaf..3eb7a56c086772ed5aae87f9fedc8a9ee1da0084 100644 (file)
@@ -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)
index 88f74b57f05e5bd5aae31f3cc4d2b10205d19853..970917558d4f1946d90400bfc100e8f774415214 100644 (file)
@@ -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();
        }