Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MSG_process_get_data(): don't segfault if there the process has been cleaned up
authorGabriel Corona <gabriel.corona@loria.fr>
Mon, 22 Jun 2015 12:41:39 +0000 (14:41 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Mon, 22 Jun 2015 12:41:54 +0000 (14:41 +0200)
src/msg/msg_process.c
src/simix/smx_private.h

index c3038c7..44d3838 100644 (file)
@@ -239,7 +239,10 @@ void* MSG_process_get_data(msg_process_t process)
 
   /* get from SIMIX the MSG process data, and then the user data */
   simdata_process_t simdata = simcall_process_get_data(process);
-  return simdata->data;
+  if (simdata)
+    return simdata->data;
+  else
+    return NULL;
 }
 
 /** \ingroup m_process_management
index 60831b8..9576a92 100644 (file)
@@ -47,6 +47,7 @@ typedef struct s_smx_global {
   xbt_dict_t registered_functions;
   smx_creation_func_t create_process_function;
   void_pfn_smxprocess_t_smxprocess_t kill_process_function;
+  /** Callback used when killing a SMX_process */
   void_pfn_smxprocess_t cleanup_process_function;
   xbt_mallocator_t synchro_mallocator;
   void_pfn_smxhost_t autorestart;