Skip to content

Commit 732542f

Browse files
author
erh
committed
Fix Coverity issue 1579. Check retval from getmntopts(). Use freemntopts().
1 parent 823ef16 commit 732542f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

sbin/mount_union/mount_union.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: mount_union.c,v 1.14 2005/02/05 15:14:25 xtraeme Exp $ */
1+
/* $NetBSD: mount_union.c,v 1.15 2006/03/17 06:51:00 erh Exp $ */
22

33
/*
44
* Copyright (c) 1992, 1993, 1994
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\n\
4242
#if 0
4343
static char sccsid[] = "@(#)mount_union.c 8.6 (Berkeley) 4/26/95";
4444
#else
45-
__RCSID("$NetBSD: mount_union.c,v 1.14 2005/02/05 15:14:25 xtraeme Exp $");
45+
__RCSID("$NetBSD: mount_union.c,v 1.15 2006/03/17 06:51:00 erh Exp $");
4646
#endif
4747
#endif /* not lint */
4848

@@ -84,6 +84,7 @@ mount_union(int argc, char *argv[])
8484
struct union_args args;
8585
int ch, mntflags;
8686
char target[MAXPATHLEN], canon_dir[MAXPATHLEN];
87+
mntoptparse_t pmop;
8788

8889

8990
mntflags = 0;
@@ -95,7 +96,10 @@ mount_union(int argc, char *argv[])
9596
args.mntflags |= UNMNT_BELOW;
9697
break;
9798
case 'o':
98-
getmntopts(optarg, mopts, &mntflags, 0);
99+
pmop = getmntopts(optarg, mopts, &mntflags, 0);
100+
if (!pmop)
101+
err(1, "getmntopts");
102+
freemntopts(pmop);
99103
break;
100104
case 'r':
101105
args.mntflags &= ~UNMNT_OPMASK;

0 commit comments

Comments
 (0)