Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/mtree resource leak (Coverity issues 274383 and 274...
details: https://anonhg.NetBSD.org/src/rev/88ef9712a27b
branches: trunk
changeset: 780200:88ef9712a27b
user: spz <spz%NetBSD.org@localhost>
date: Sun Jul 15 09:08:29 2012 +0000
description:
resource leak (Coverity issues 274383 and 274384)
diffstat:
usr.sbin/mtree/create.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diffs (48 lines):
diff -r e17edc16e9a4 -r 88ef9712a27b usr.sbin/mtree/create.c
--- a/usr.sbin/mtree/create.c Sun Jul 15 08:44:56 2012 +0000
+++ b/usr.sbin/mtree/create.c Sun Jul 15 09:08:29 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: create.c,v 1.58 2009/04/03 21:18:59 apb Exp $ */
+/* $NetBSD: create.c,v 1.59 2012/07/15 09:08:29 spz Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: create.c,v 1.58 2009/04/03 21:18:59 apb Exp $");
+__RCSID("$NetBSD: create.c,v 1.59 2012/07/15 09:08:29 spz Exp $");
#endif
#endif /* not lint */
@@ -259,9 +259,11 @@
(p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE))
output(&indent, "link=%s", vispath(rlink(p->fts_accpath)));
#if HAVE_STRUCT_STAT_ST_FLAGS
- if (keys & F_FLAGS && p->fts_statp->st_flags != flags)
- output(&indent, "flags=%s",
- flags_to_string(p->fts_statp->st_flags, "none"));
+ if (keys & F_FLAGS && p->fts_statp->st_flags != flags) {
+ char *str = flags_to_string(p->fts_statp->st_flags, "none");
+ output(&indent, "flags=%s", str);
+ free(str);
+ }
#endif
putchar('\n');
}
@@ -372,9 +374,11 @@
printf(" mode=%#lo", (u_long)savemode);
if (keys & F_NLINK)
printf(" nlink=1");
- if (keys & F_FLAGS)
- printf(" flags=%s",
- flags_to_string(saveflags, "none"));
+ if (keys & F_FLAGS) {
+ char *str = flags_to_string(saveflags, "none");
+ printf(" flags=%s", str);
+ free(str);
+ }
printf("\n");
*puid = saveuid;
*pgid = savegid;
Home |
Main Index |
Thread Index |
Old Index