Skip to content

Commit c9598ed

Browse files
committed
tools/mpirun: Fix some memory leaks by using setenv().
Signed-off-by: Austen Lauria <[email protected]>
1 parent 8c1495d commit c9598ed

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

ompi/tools/mpirun/main.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
int main(int argc, char *argv[])
2929
{
3030
char *evar;
31-
#if OPAL_USING_INTERNAL_PMIX || OMPI_USING_INTERNAL_PRRTE
32-
char *pvar;
33-
#endif
3431
char **pargs = NULL;
3532
char *pfx = NULL;
3633
int m, param_len;
@@ -39,16 +36,14 @@ int main(int argc, char *argv[])
3936
if (NULL != (evar = getenv("OPAL_PREFIX"))) {
4037

4138
#if OMPI_USING_INTERNAL_PRRTE
42-
opal_asprintf(&pvar, "PRTE_PREFIX=%s", evar);
43-
putenv(pvar);
39+
setenv("PRTE_PREFIX", evar, 1);
4440
#endif
4541

4642
#if OPAL_USING_INTERNAL_PMIX
47-
opal_asprintf(&pvar, "PMIX_PREFIX=%s", evar);
48-
putenv(pvar);
43+
setenv("PMIX_PREFIX", evar, 1);
4944
#endif
5045
}
51-
putenv("PRTE_MCA_schizo_proxy=ompi");
46+
setenv("PRTE_MCA_schizo_proxy", "ompi", 1);
5247

5348
opal_argv_append_nosize(&pargs, "prterun");
5449
for (m=1; NULL != argv[m]; m++) {

0 commit comments

Comments
 (0)