Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add condition before use a mmalloc function.
[simgrid.git] / src / simix / smx_synchro.c
index 1aaacc5..5de5313 100644 (file)
@@ -349,12 +349,11 @@ smx_sem_t SIMIX_sem_init(int capacity) {
 }
 /** @brief Destroys a semaphore */
 void SIMIX_sem_destroy(smx_sem_t sem) {
+  smx_action_t action = NULL;
   DEBUG1("Destroy semaphore %p", sem);
   if (sem == NULL)
     return;
 
-  smx_action_t action = NULL;
-
   xbt_assert0(xbt_swag_size(sem->sleeping) == 0,
       "Cannot destroy semaphore since someone is still using it");
   xbt_swag_free(sem->sleeping);