From 7ac3bc9f830a8ea1ebdf4738e883bdc01522c31f Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 25 Oct 2019 09:33:17 +0200 Subject: Network proxy (macOS) - fix a memory leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit there are several conditional statements where we return without releasing a dictionary (which is returned by a function having 'Copy' in its name, thus giving us the ownership == CFRelease is needed). QCFType fixes this issue. Fixes: QTBUG-79524 Change-Id: Id8a8616ad5b6ec21b5e8103bf52b1d9df9ca5c2f Reviewed-by: MÃ¥rten Nordheim --- src/network/kernel/qnetworkproxy_mac.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/network/kernel/qnetworkproxy_mac.cpp b/src/network/kernel/qnetworkproxy_mac.cpp index 92f91956b9..67fda24ea6 100644 --- a/src/network/kernel/qnetworkproxy_mac.cpp +++ b/src/network/kernel/qnetworkproxy_mac.cpp @@ -210,16 +210,14 @@ QList macQueryInternal(const QNetworkProxyQuery &query) QList result; // obtain a dictionary to the proxy settings: - CFDictionaryRef dict = SCDynamicStoreCopyProxies(NULL); + const QCFType dict = SCDynamicStoreCopyProxies(NULL); if (!dict) { qWarning("QNetworkProxyFactory::systemProxyForQuery: SCDynamicStoreCopyProxies returned NULL"); return result; // failed } - if (isHostExcluded(dict, query.peerHostName())) { - CFRelease(dict); + if (isHostExcluded(dict, query.peerHostName())) return result; // no proxy for this host - } // is there a PAC enabled? If so, use it first. CFNumberRef pacEnabled; @@ -329,7 +327,6 @@ QList macQueryInternal(const QNetworkProxyQuery &query) result << https; } - CFRelease(dict); return result; } -- cgit v1.2.3