]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
detect_proxy: fix possible single-byte memory leak
authorDaniel Stenberg <daniel@haxx.se>
Thu, 2 Oct 2014 21:31:01 +0000 (23:31 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 2 Oct 2014 21:31:01 +0000 (23:31 +0200)
Coverity CID 1202836. If the proxy environment variable returned an empty
string, it would be leaked. While an empty string is not really a proxy, other
logic in this function already allows a blank string to be returned so allow
that here to avoid the leak.

lib/url.c

index 69a75e31086f791fa1d066465a9dff27d12bfe83..0ee6fb042b152724442675b782be098bff0fe15b 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -4339,9 +4339,8 @@ static char *detect_proxy(struct connectdata *conn)
       prox=curl_getenv(proxy_env);
     }
 
-    if(prox && *prox) { /* don't count "" strings */
+    if(prox)
       proxy = prox; /* use this */
-    }
     else {
       proxy = curl_getenv("all_proxy"); /* default proxy to use */
       if(!proxy)