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>
This commit is contained in:
parent
dd0cd71170
commit
7ac3bc9f83
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user