Skip to content

Commit 7a039fa

Browse files
authored
Merge pull request #3452 from jsquyres/pr/v2.0.x/fix-errhandler-string-free
v2.0.x: ompi/errhandler: cherry-pick missing commit
2 parents c5c5e2b + 4e2eb21 commit 7a039fa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ompi/errhandler/errhandler_predefined.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
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
@@ -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
@@ -211,6 +213,8 @@ static void backend_fatal_aggregate(char *type,
211213
err_msg = NULL;
212214
opal_output(0, "%s", "Could not write to err_msg");
213215
opal_output(0, unknown_error_code, *error_code);
216+
} else {
217+
generated = true;
214218
}
215219
}
216220
}
@@ -256,7 +260,9 @@ static void backend_fatal_aggregate(char *type,
256260
}
257261

258262
free(prefix);
259-
free(err_msg);
263+
if (generated) {
264+
free(err_msg);
265+
}
260266
}
261267

262268
/*

0 commit comments

Comments
 (0)