1515 * Copyright (c) 2010-2011 Oak Ridge National Labs. All rights reserved.
1616 * Copyright (c) 2012 Los Alamos National Security, LLC.
1717 * All rights reserved.
18+ * Copyright (c) 2016 Intel, Inc. All rights reserved.
1819 * $COPYRIGHT$
1920 *
2021 * Additional copyrights may follow
@@ -51,7 +52,7 @@ static void out(char *str, char *arg);
5152
5253
5354void ompi_mpi_errors_are_fatal_comm_handler (struct ompi_communicator_t * * comm ,
54- int * error_code , ...)
55+ int * error_code , ...)
5556{
5657 char * name ;
5758 struct ompi_communicator_t * abort_comm ;
@@ -72,7 +73,7 @@ void ompi_mpi_errors_are_fatal_comm_handler(struct ompi_communicator_t **comm,
7273
7374
7475void ompi_mpi_errors_are_fatal_file_handler (struct ompi_file_t * * file ,
75- int * error_code , ...)
76+ int * error_code , ...)
7677{
7778 char * name ;
7879 struct ompi_communicator_t * abort_comm ;
@@ -93,7 +94,7 @@ void ompi_mpi_errors_are_fatal_file_handler(struct ompi_file_t **file,
9394
9495
9596void ompi_mpi_errors_are_fatal_win_handler (struct ompi_win_t * * win ,
96- int * error_code , ...)
97+ int * error_code , ...)
9798{
9899 char * name ;
99100 struct ompi_communicator_t * abort_comm = NULL ;
@@ -111,7 +112,7 @@ void ompi_mpi_errors_are_fatal_win_handler(struct ompi_win_t **win,
111112}
112113
113114void ompi_mpi_errors_return_comm_handler (struct ompi_communicator_t * * comm ,
114- int * error_code , ...)
115+ int * error_code , ...)
115116{
116117 /* Don't need anything more -- just need this function to exist */
117118 /* Silence some compiler warnings */
@@ -123,7 +124,7 @@ void ompi_mpi_errors_return_comm_handler(struct ompi_communicator_t **comm,
123124
124125
125126void ompi_mpi_errors_return_file_handler (struct ompi_file_t * * file ,
126- int * error_code , ...)
127+ int * error_code , ...)
127128{
128129 /* Don't need anything more -- just need this function to exist */
129130 /* Silence some compiler warnings */
@@ -135,7 +136,7 @@ void ompi_mpi_errors_return_file_handler(struct ompi_file_t **file,
135136
136137
137138void ompi_mpi_errors_return_win_handler (struct ompi_win_t * * win ,
138- int * error_code , ...)
139+ int * error_code , ...)
139140{
140141 /* Don't need anything more -- just need this function to exist */
141142 /* Silence some compiler warnings */
@@ -181,6 +182,7 @@ static void backend_fatal_aggregate(char *type,
181182 const char * const unknown_error_code = "Error code: %d (no associated error message)" ;
182183 const char * const unknown_error = "Unknown error" ;
183184 const char * const unknown_prefix = "[?:?]" ;
185+ bool generated = false;
184186
185187 // these do not own what they point to; they're
186188 // here to avoid repeating expressions such as
@@ -209,6 +211,8 @@ static void backend_fatal_aggregate(char *type,
209211 err_msg = NULL ;
210212 opal_output (0 , "%s" , "Could not write to err_msg" );
211213 opal_output (0 , unknown_error_code , * error_code );
214+ } else {
215+ generated = true;
212216 }
213217 }
214218 }
@@ -254,7 +258,9 @@ static void backend_fatal_aggregate(char *type,
254258 }
255259
256260 free (prefix );
257- free (err_msg );
261+ if (generated ) {
262+ free (err_msg );
263+ }
258264}
259265
260266/*
0 commit comments