From 646c2b2171b3af9e4b3a94852078de861d4b2939 Mon Sep 17 00:00:00 2001 From: Josh Hursey Date: Sat, 21 Apr 2007 21:51:18 +0000 Subject: [PATCH] This commit fixes trac:1002. Protect the free and strdup values for replacing keyval pairs just as we do below in the files for new keyval pairs. In basic testing this seems to make everything work as it should again. This commit was SVN r14460. The following Trac tickets were found above: Ticket 1002 --> https://svn.open-mpi.org/trac/ompi/ticket/1002 --- opal/mca/base/mca_base_parse_paramfile.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/opal/mca/base/mca_base_parse_paramfile.c b/opal/mca/base/mca_base_parse_paramfile.c index d2de63c20c..9c8d10245f 100644 --- a/opal/mca/base/mca_base_parse_paramfile.c +++ b/opal/mca/base/mca_base_parse_paramfile.c @@ -50,8 +50,14 @@ static void save_value(const char *name, const char *value) item = opal_list_get_next(item)) { fv = (mca_base_param_file_value_t *) item; if (0 == strcmp(name, fv->mbpfv_param)) { - free(fv->mbpfv_value); - fv->mbpfv_value = strdup(value); + if (NULL != fv->mbpfv_value ) { + free(fv->mbpfv_value); + } + if (NULL != value) { + fv->mbpfv_value = strdup(value); + } else { + fv->mbpfv_value = NULL; + } return; } }