1
1

* Add a check for whether we're operating on environ; if so, don't

free anything.
 * Fix a small memory leak.

This commit was SVN r12245.
Этот коммит содержится в:
Jeff Squyres 2006-10-21 13:46:04 +00:00
родитель 2a863df0a5
Коммит 7b6536e912

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -201,11 +202,16 @@ int opal_unsetenv(const char *name, char ***env)
if (found) { if (found) {
(*env)[i] = (*env)[i + 1]; (*env)[i] = (*env)[i + 1];
} else if (0 == strncmp((*env)[i], compare, len)) { } else if (0 == strncmp((*env)[i], compare, len)) {
free((*env)[i]); #if !defined(__WINDOWS__)
if (environ != *env) {
free((*env)[i]);
}
#endif
(*env)[i] = (*env)[i + 1]; (*env)[i] = (*env)[i + 1];
found = true; found = true;
} }
} }
free(compare);
/* All done */ /* All done */