QCocoaPrintDevice: fix bad CFRelease

CFRelease should be called IFF PMPrinterCopyDescriptionURL succeeds

Change-Id: Id289aea3a4e3da397dae4062319256a043538597
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
This commit is contained in:
Dyami Caliri 2014-10-29 14:10:05 -07:00
parent af5f6e35b6
commit dd6876f3fd

View File

@ -468,11 +468,11 @@ bool QCocoaPrintDevice::openPpdFile()
CFURLRef ppdURL = NULL;
char ppdPath[MAXPATHLEN];
if (PMPrinterCopyDescriptionURL(m_printer, kPMPPDDescriptionType, &ppdURL) == noErr
&& ppdURL != NULL
&& CFURLGetFileSystemRepresentation(ppdURL, true, (UInt8*)ppdPath, sizeof(ppdPath))) {
m_ppd = ppdOpenFile(ppdPath);
&& ppdURL != NULL) {
if (CFURLGetFileSystemRepresentation(ppdURL, true, (UInt8*)ppdPath, sizeof(ppdPath)))
m_ppd = ppdOpenFile(ppdPath);
CFRelease(ppdURL);
}
CFRelease(ppdURL);
return m_ppd ? true : false;
}