Do not pass a null pointer to unlink()

Found by clang static analyzer.

Change-Id: I8f15ae1a8e6afb91eafa6cee1d1b21e3539af6c1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
This commit is contained in:
Alexander Volkov 2014-11-05 12:56:26 +04:00
parent 0b54de41bc
commit 3c0ea78283

View File

@ -470,9 +470,10 @@ void QPpdPrintDevice::loadPrinter()
m_cupsDest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, m_cupsName, m_cupsInstance);
if (m_cupsDest) {
const char *ppdFile = cupsGetPPD(m_cupsName);
if (ppdFile)
if (ppdFile) {
m_ppd = ppdOpenFile(ppdFile);
unlink(ppdFile);
unlink(ppdFile);
}
if (m_ppd) {
ppdMarkDefaults(m_ppd);
} else {