On Monday 22 November 2010 12:59:34 David Woodhouse wrote:
--- a/zypp/media/proxyinfo/ProxyInfoLibproxy.cc +++ b/zypp/media/proxyinfo/ProxyInfoLibproxy.cc @@ -73,8 +73,9 @@ namespace zypp { if (!result) return "";
- /* Yes, there's a memory leak here */ - return result; + std::string sresult = result; + free(result); + return sresult; }
I' vote for an undelayed 'free()': /* cURL can only handle HTTP proxies, not SOCKS. And can only handle one. So look through the list and find an appropriate one. */ - char *result = NULL; + std::string result; for (int i = 0; proxies[i]; i++) { - if (!result && + if (result.empty() && !strncmp(proxies[i], "http://", 7)) result = proxies[i]; - else - free(proxies[i]); + free(proxies[i]); - } free(proxies); - if (!result) - return ""; - - /* Yes, there's a memory leak here */ return result; } -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres ZYPP Development ma@suse.de SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0 +------------------------------------------------------------------+ -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org