summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-03-28 10:14:54 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-03-28 13:13:59 +0000
commit22a7f8b1f5a4955e5b1500e1f58a7cdc72f1c5d9 (patch)
tree77d11180de48f6cd03940001159089d2ea48eca2 /shell
parent1ada4551539fee3b8dee095ba53bbcbcfcc34c43 (diff)
coverity#982766 Dereference null return value
Change-Id: Ic9efce80ea2c2489e3ef070ac4c6106c811e9889
Diffstat (limited to 'shell')
-rw-r--r--shell/source/unix/exec/shellexec.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx
index e1a923d4a8e4..6ecad95e6c81 100644
--- a/shell/source/unix/exec/shellexec.cxx
+++ b/shell/source/unix/exec/shellexec.cxx
@@ -258,12 +258,16 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar
#else
aBuffer.makeStringAndClear();
#endif
- if ( 0 != pclose(popen(cmd.getStr(), "w")) )
+ FILE *pLaunch = popen(cmd.getStr(), "w");
+ if ( pLaunch != NULL )
{
- int nerr = errno;
- throw SystemShellExecuteException(OUString::createFromAscii( strerror( nerr ) ),
- static_cast < XSystemShellExecute * > (this), nerr );
+ if ( 0 == pclose( pLaunch ) )
+ return;
}
+
+ int nerr = errno;
+ throw SystemShellExecuteException(OUString::createFromAscii( strerror( nerr ) ),
+ static_cast < XSystemShellExecute * > (this), nerr );
}
// XServiceInfo