From 52fc8fcc47083060533ec0bc6c60b452a4eeb7f0 Mon Sep 17 00:00:00 2001 From: Ray Lai Date: Sat, 8 Apr 2006 01:41:33 +0000 Subject: Memory leak on fork error plus change time variable to prevent shadowing time(3) function. From NetBSD from Coverity CID 1688. OK jaredy@ and moritz@ --- sbin/mount/mount.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sbin/mount') diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 7da3046b379..67bd1b7db6e 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mount.c,v 1.41 2006/03/12 20:01:31 otto Exp $ */ +/* $OpenBSD: mount.c,v 1.42 2006/04/08 01:41:32 ray Exp $ */ /* $NetBSD: mount.c,v 1.24 1995/11/18 03:34:29 cgd Exp $ */ /* @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)mount.c 8.19 (Berkeley) 4/19/94"; #else -static char rcsid[] = "$OpenBSD: mount.c,v 1.41 2006/03/12 20:01:31 otto Exp $"; +static char rcsid[] = "$OpenBSD: mount.c,v 1.42 2006/04/08 01:41:32 ray Exp $"; #endif #endif /* not lint */ @@ -413,6 +413,7 @@ mountfs(const char *vfstype, const char *spec, const char *name, case -1: /* Error. */ warn("fork"); free(optbuf); + free(argv); return (1); case 0: /* Child. */ /* Go find an executable. */ @@ -487,9 +488,9 @@ prmount(struct statfs *sf) if (verbose) { char buf[26]; - time_t time = sf->f_ctime; + time_t t = sf->f_ctime; - ctime_r(&time, buf); + ctime_r(&t, buf); buf[24] = '\0'; printf(", ctime=%s", buf); } -- cgit v1.2.3