Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tools/compat don't leak on error.
details: https://anonhg.NetBSD.org/src/rev/dba22f511c77
branches: trunk
changeset: 785238:dba22f511c77
user: christos <christos%NetBSD.org@localhost>
date: Tue Mar 05 16:29:09 2013 +0000
description:
don't leak on error.
diffstat:
tools/compat/dprintf.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (21 lines):
diff -r b8cefb653308 -r dba22f511c77 tools/compat/dprintf.c
--- a/tools/compat/dprintf.c Tue Mar 05 16:28:06 2013 +0000
+++ b/tools/compat/dprintf.c Tue Mar 05 16:29:09 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dprintf.c,v 1.1 2013/03/05 16:26:41 christos Exp $ */
+/* $NetBSD: dprintf.c,v 1.2 2013/03/05 16:29:09 christos Exp $ */
/*-
* Copyright (c) 2013 NetBSD Foundation, Inc.
@@ -52,8 +52,10 @@
if ((e = dup(fd)) == -1)
return -1;
- if ((fp = fdopen(e, "r+")) == NULL)
+ if ((fp = fdopen(e, "r+")) == NULL) {
+ (void)close(e);
return -1;
+ }
va_start(ap, fmt);
e = vfprintf(fp, fmt, ap);
Home |
Main Index |
Thread Index |
Old Index