summaryrefslogtreecommitdiff
path: root/posix
diff options
context:
space:
mode:
authorJames Thomas <james.thomas@codethink.co.uk>2017-03-02 14:07:23 +0000
committerJames Thomas <james.thomas@codethink.co.uk>2017-03-02 14:07:23 +0000
commitd9918c3d29045e32351d1deeabf701eba7ece65a (patch)
tree9e2c8761e181f02660d090e48f4771672b7cd0c9 /posix
parente0281d82c277776c9ea5ae4a272a6a7a950b039c (diff)
downloadjack2-d9918c3d29045e32351d1deeabf701eba7ece65a.tar.gz
Fix a crash in JackPosixSemaphore::Wait()
Crash was observed in this function when fSemaphore was NULL, this patch copies the NULL pointer check from the commented function above into Wait()
Diffstat (limited to 'posix')
-rw-r--r--posix/JackPosixSemaphore.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/posix/JackPosixSemaphore.cpp b/posix/JackPosixSemaphore.cpp
index 6eccbe58..bdd3c449 100644
--- a/posix/JackPosixSemaphore.cpp
+++ b/posix/JackPosixSemaphore.cpp
@@ -102,6 +102,11 @@ bool JackPosixSemaphore::Wait()
{
int res;
+ if (!fSemaphore) {
+ jack_error("JackPosixSemaphore::Wait name = %s already deallocated!!", fName);
+ return false;
+ }
+
while ((res = sem_wait(fSemaphore) < 0)) {
jack_error("JackPosixSemaphore::Wait name = %s err = %s", fName, strerror(errno));
if (errno != EINTR) {