From: Gabriel Corona Date: Mon, 22 Jun 2015 12:41:39 +0000 (+0200) Subject: MSG_process_get_data(): don't segfault if there the process has been cleaned up X-Git-Tag: v3_12~566 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/908c7a9f9135f982b3cbc232d45170e450682d39 MSG_process_get_data(): don't segfault if there the process has been cleaned up --- diff --git a/src/msg/msg_process.c b/src/msg/msg_process.c index c3038c7a86..44d3838ad8 100644 --- a/src/msg/msg_process.c +++ b/src/msg/msg_process.c @@ -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 diff --git a/src/simix/smx_private.h b/src/simix/smx_private.h index 60831b8b6a..9576a92e2b 100644 --- a/src/simix/smx_private.h +++ b/src/simix/smx_private.h @@ -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;