diff options
| author | tron <tron@NetBSD.org> | 2010-10-02 10:55:36 +0000 |
|---|---|---|
| committer | tron <tron@NetBSD.org> | 2010-10-02 10:55:36 +0000 |
| commit | c71ba331c0788fd0d7b9dd63ef65cc477cccc4ed (patch) | |
| tree | 5f7e2f7526f0153ca40b1f8b68b6b5e0f4e7d911 | |
| parent | c3bcf19cf7770f0596e785abec7d0831fb5a90ee (diff) | |
Don't free memory that was succesfully passed to putenv(3) which takes
ownership of the memory.
| -rw-r--r-- | usr.bin/su/su_pam.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/su/su_pam.c b/usr.bin/su/su_pam.c index 20e75c6646c..fc612afffbc 100644 --- a/usr.bin/su/su_pam.c +++ b/usr.bin/su/su_pam.c @@ -1,4 +1,4 @@ -/* $NetBSD: su_pam.c,v 1.15 2008/07/21 14:19:26 lukem Exp $ */ +/* $NetBSD: su_pam.c,v 1.16 2010/10/02 10:55:36 tron Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988\ #if 0 static char sccsid[] = "@(#)su.c 8.3 (Berkeley) 4/2/94";*/ #else -__RCSID("$NetBSD: su_pam.c,v 1.15 2008/07/21 14:19:26 lukem Exp $"); +__RCSID("$NetBSD: su_pam.c,v 1.16 2010/10/02 10:55:36 tron Exp $"); #endif #endif /* not lint */ @@ -469,8 +469,8 @@ out: * how could we get untrusted data here? */ for (envitem = pamenv; *envitem; envitem++) { - (void)putenv(*envitem); - free(*envitem); + if (putenv(*envitem) == -1) + free(*envitem); } free(pamenv); |
