Fix Coverity issue 1579. Check retval from getmntopts(). Use freemntopts().

This commit is contained in:
erh 2006-03-17 06:51:00 +00:00
parent 0ca5044c4a
commit e1806cf352
1 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mount_union.c,v 1.14 2005/02/05 15:14:25 xtraeme Exp $ */
/* $NetBSD: mount_union.c,v 1.15 2006/03/17 06:51:00 erh Exp $ */
/*
* Copyright (c) 1992, 1993, 1994
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\n\
#if 0
static char sccsid[] = "@(#)mount_union.c 8.6 (Berkeley) 4/26/95";
#else
__RCSID("$NetBSD: mount_union.c,v 1.14 2005/02/05 15:14:25 xtraeme Exp $");
__RCSID("$NetBSD: mount_union.c,v 1.15 2006/03/17 06:51:00 erh Exp $");
#endif
#endif /* not lint */
@ -84,6 +84,7 @@ mount_union(int argc, char *argv[])
struct union_args args;
int ch, mntflags;
char target[MAXPATHLEN], canon_dir[MAXPATHLEN];
mntoptparse_t pmop;
mntflags = 0;
@ -95,7 +96,10 @@ mount_union(int argc, char *argv[])
args.mntflags |= UNMNT_BELOW;
break;
case 'o':
getmntopts(optarg, mopts, &mntflags, 0);
pmop = getmntopts(optarg, mopts, &mntflags, 0);
if (!pmop)
err(1, "getmntopts");
freemntopts(pmop);
break;
case 'r':
args.mntflags &= ~UNMNT_OPMASK;