Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sup/source Fix fd leaks in error cases. Found by cp...
details: https://anonhg.NetBSD.org/src/rev/a953f32eae9c
branches: trunk
changeset: 760404:a953f32eae9c
user: wiz <wiz%NetBSD.org@localhost>
date: Tue Jan 04 10:14:25 2011 +0000
description:
Fix fd leaks in error cases. Found by cppcheck.
diffstat:
usr.sbin/sup/source/scan.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r a7d03ff4a0cb -r a953f32eae9c usr.sbin/sup/source/scan.c
--- a/usr.sbin/sup/source/scan.c Tue Jan 04 10:10:39 2011 +0000
+++ b/usr.sbin/sup/source/scan.c Tue Jan 04 10:14:25 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scan.c,v 1.27 2009/10/17 20:46:03 christos Exp $ */
+/* $NetBSD: scan.c,v 1.28 2011/01/04 10:14:25 wiz Exp $ */
/*
* Copyright (c) 1992 Carnegie Mellon University
@@ -968,9 +968,9 @@
if (scanF == NULL)
goto out;
if (fprintf(scanF, "V%d\n", SCANVERSION) < 0)
- goto out;
+ goto closeout;
if (Tprocess(listT, recordone, scanF) != SCMOK)
- goto out;
+ goto closeout;
if (fclose(scanF) != 0)
goto out;
if (rename(tname, fname) < 0) {
@@ -983,6 +983,8 @@
tbuf[1].tv_usec = 0;
(void) utimes(fname, tbuf);
return;
+closeout:
+ (void) fclose(scanF);
out:
goaway("Can't write scan file temp %s for %s", tname, collname);
}
Home |
Main Index |
Thread Index |
Old Index