diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2019-10-25 09:33:17 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2019-10-27 20:40:45 +0200 |
commit | 7ac3bc9f830a8ea1ebdf4738e883bdc01522c31f (patch) | |
tree | ecdfd0b8cb2c9448a0a590c4dcdbfa80a9eea4d2 /src/network/kernel | |
parent | dd0cd711708f65c429f807f42456bff14404f9c0 (diff) |
Network proxy (macOS) - fix a memory leak
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 <marten.nordheim@qt.io>
Diffstat (limited to 'src/network/kernel')
-rw-r--r-- | src/network/kernel/qnetworkproxy_mac.cpp | 7 |
1 files 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<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query) QList<QNetworkProxy> result; // obtain a dictionary to the proxy settings: - CFDictionaryRef dict = SCDynamicStoreCopyProxies(NULL); + const QCFType<CFDictionaryRef> 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<QNetworkProxy> macQueryInternal(const QNetworkProxyQuery &query) result << https; } - CFRelease(dict); return result; } |