Whoops, DosCloseMutexSem() needs to free memory we previously allocated. default tip
authorRyan C. Gordon <icculus@icculus.org>
Fri, 15 Sep 2017 10:49:26 -0400
changeset 76 40c940ca1588
parent 75 d6286f62f959
Whoops, DosCloseMutexSem() needs to free memory we previously allocated.
native/doscalls.c
--- a/native/doscalls.c	Thu Sep 14 23:51:04 2017 -0400
+++ b/native/doscalls.c	Fri Sep 15 10:49:26 2017 -0400
@@ -3004,11 +3004,13 @@
     if (hmtx) {
         pthread_mutex_t *mutex = (pthread_mutex_t *) hmtx;
         const int rc = pthread_mutex_destroy(mutex);
-        if (rc == 0)
+        if (rc == EBUSY) {
+            return ERROR_SEM_BUSY;
+        } else if (rc == 0) {
+            free(mutex);
             return NO_ERROR;
-        else if (rc == EBUSY)
-            return ERROR_SEM_BUSY;
-    }
+        } // else if
+    } // if
 
     return ERROR_INVALID_HANDLE;
 } // DosCloseMutexSem