summaryrefslogtreecommitdiff
path: root/Source/cmFindProgramCommand.cxx
diff options
context:
space:
mode:
authorBjoern Ricks <bjoern.ricks@intevation.de>2012-02-25 18:20:36 +0100
committerBjoern Ricks <bjoern.ricks@intevation.de>2012-02-25 18:20:36 +0100
commit0d2f5c8d6a3384816310aec2478cf9e3877e8569 (patch)
treee4b5b5f9257c1d6cb88f363390af3fd132bbed09 /Source/cmFindProgramCommand.cxx
parentf3fe73da548a90e6682fd6a650d923151950003d (diff)
downloadcmake-0d2f5c8d6a3384816310aec2478cf9e3877e8569.tar.gz
Fix crash if app bundle executeable couldn't be found
Fix a crash on Mac OS X if a programm can't be found as an application bundle. CFRelease MUST NOT be called on a NULL value. See https://developer.apple.com/library/mac/documentation/CoreFOundation/Reference/CFTypeRef/Reference/reference.html#//apple_ref/doc/c_ref/CFRelease
Diffstat (limited to 'Source/cmFindProgramCommand.cxx')
-rw-r--r--Source/cmFindProgramCommand.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index 7c56ad7ce4..00f5419c2e 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -175,6 +175,8 @@ std::string cmFindProgramCommand::GetBundleExecutable(std::string bundlePath)
// And finally to a c++ string
executable = bundlePath + "/Contents/MacOS/" + std::string(buffer);
+ // Only release CFURLRef if it's not null
+ CFRelease( executableURL );
}
// Any CF objects returned from functions with "create" or
@@ -182,7 +184,6 @@ std::string cmFindProgramCommand::GetBundleExecutable(std::string bundlePath)
CFRelease( bundlePathCFS );
CFRelease( bundleURL );
CFRelease( appBundle );
- CFRelease( executableURL );
#endif
return executable;