Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MSG: don't keep pointers to a structure freed
authorChristophe Thiéry <christopho128@gmail.com>
Fri, 6 Jan 2012 14:26:26 +0000 (15:26 +0100)
committerChristophe Thiéry <christopho128@gmail.com>
Fri, 6 Jan 2012 14:26:26 +0000 (15:26 +0100)
src/msg/msg_process.c

index 8a2f8ea..5030416 100644 (file)
@@ -26,6 +26,11 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_process, msg,
  */
 
 /******************************** Process ************************************/
  */
 
 /******************************** Process ************************************/
+
+/**
+ * \brief Cleans the MSG data of a process.
+ * \param smx_proc a SIMIX process
+ */
 void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc)
 {
   simdata_process_t msg_proc;
 void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc)
 {
   simdata_process_t msg_proc;
@@ -33,9 +38,11 @@ void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc)
   if (smx_proc == SIMIX_process_self()) {
     /* avoid a SIMIX request if this function is called by the process itself */
     msg_proc = SIMIX_process_self_get_data(smx_proc);
   if (smx_proc == SIMIX_process_self()) {
     /* avoid a SIMIX request if this function is called by the process itself */
     msg_proc = SIMIX_process_self_get_data(smx_proc);
+    SIMIX_process_self_set_data(smx_proc, NULL);
   }
   else {
     msg_proc = SIMIX_req_process_get_data(smx_proc);
   }
   else {
     msg_proc = SIMIX_req_process_get_data(smx_proc);
+    SIMIX_req_process_set_data(smx_proc, NULL);
   }
 
 #ifdef HAVE_TRACING
   }
 
 #ifdef HAVE_TRACING