diff options
| author | christos <christos@NetBSD.org> | 2006-05-25 01:49:30 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2006-05-25 01:49:30 +0000 |
| commit | fb0d335338310f6a4e647153d9e9d7bdffaf8c82 (patch) | |
| tree | abb50b492b71e268e218ed0a2eefb5750711af9b /usr.sbin/pstat | |
| parent | d8050237b65c40eb3bd3932dab5d863098dee93d (diff) | |
Coverity CID 3377: Fix memory leak on error.
Diffstat (limited to 'usr.sbin/pstat')
| -rw-r--r-- | usr.sbin/pstat/pstat.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c index 3b9b1a4abb3..e86046de9b4 100644 --- a/usr.sbin/pstat/pstat.c +++ b/usr.sbin/pstat/pstat.c @@ -1,4 +1,4 @@ -/* $NetBSD: pstat.c,v 1.94 2006/03/17 21:01:02 elad Exp $ */ +/* $NetBSD: pstat.c,v 1.95 2006/05/25 01:49:30 christos Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\n\ #if 0 static char sccsid[] = "@(#)pstat.c 8.16 (Berkeley) 5/9/95"; #else -__RCSID("$NetBSD: pstat.c,v 1.94 2006/03/17 21:01:02 elad Exp $"); +__RCSID("$NetBSD: pstat.c,v 1.95 2006/05/25 01:49:30 christos Exp $"); #endif #endif /* not lint */ @@ -651,13 +651,15 @@ getmnt(struct mount *maddr) struct mount mount; } *mhead = NULL; struct mtab *mt; + struct mount mb; for (mt = mhead; mt != NULL; mt = mt->next) if (maddr == mt->maddr) return (&mt->mount); + KGETRET(maddr, &mb, sizeof(struct mount), "mount table"); if ((mt = malloc(sizeof(struct mtab))) == NULL) err(1, "malloc"); - KGETRET(maddr, &mt->mount, sizeof(struct mount), "mount table"); + mt->mount = mb; mt->maddr = maddr; mt->next = mhead; mhead = mt; |
