Эх сурвалжийг харах

pthread_mutex_unlock: Return EINVAL when given NULL mutex

Jeremy Soller 6 жил өмнө
parent
commit
0fd936b4d4

+ 4 - 0
pthread_mutex_unlock.c

@@ -60,6 +60,10 @@ pthread_mutex_unlock (pthread_mutex_t * mutex)
   /*
    * Let the system deal with invalid pointers.
    */
+  if (*mutex == NULL)
+    {
+      return EINVAL;
+    }
 
   mx = *mutex;