From 544f9dd780e874464eacf38ad3c4fc99b6bb66d0 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 12 May 2005 18:56:05 +0000 Subject: [PATCH] Fix silly string error (missing +2 in the len calculation, so just replace it with asprintf). Reviewed by Brian. This commit was SVN r5700. --- src/mca/base/mca_base_cmd_line.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mca/base/mca_base_cmd_line.c b/src/mca/base/mca_base_cmd_line.c index 69e520ba9b..bf530196c6 100644 --- a/src/mca/base/mca_base_cmd_line.c +++ b/src/mca/base/mca_base_cmd_line.c @@ -94,7 +94,7 @@ int mca_base_cmd_line_process_args(ompi_cmd_line_t *cmd) */ int mca_base_cmd_line_process_arg(const char *param, const char *value) { - int i, len; + int i; char *new_str; /* Look to see if we've already got an -mca argument for the same @@ -103,9 +103,7 @@ int mca_base_cmd_line_process_arg(const char *param, const char *value) for (i = 0; NULL != mca_param_argv && NULL != mca_param_argv[i]; ++i) { if (0 == strcmp(param, mca_param_argv[i])) { - len = strlen(value) + strlen(mca_param_argv[i]); - new_str = malloc(len); - snprintf(new_str, len, "%s,%s", mca_value_argv[i], value); + asprintf(&new_str, "%s,%s", mca_value_argv[i], value); free(mca_value_argv[i]); mca_value_argv[i] = new_str;