summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-04-08 01:41:33 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-04-08 01:41:33 +0000
commit52fc8fcc47083060533ec0bc6c60b452a4eeb7f0 (patch)
tree6352403c124a67789b2f8eb7f900651d1a415b33
parente9fddb4833dadaef46f44af0cc32030b84039a36 (diff)
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@
-rw-r--r--sbin/mount/mount.c9
1 files changed, 5 insertions, 4 deletions
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);
}