Module Name: src
Committed By: wiz
Date: Tue Jan 4 09:48:21 UTC 2011
Modified Files:
src/usr.sbin/makefs/cd9660: cd9660_write.c
Log Message:
Fix fd leaks in error cases. Found by cppcheck.
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/makefs/cd9660/cd9660_write.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/makefs/cd9660/cd9660_write.c
diff -u src/usr.sbin/makefs/cd9660/cd9660_write.c:1.13 src/usr.sbin/makefs/cd9660/cd9660_write.c:1.14
--- src/usr.sbin/makefs/cd9660/cd9660_write.c:1.13 Fri Oct 22 00:49:15 2010
+++ src/usr.sbin/makefs/cd9660/cd9660_write.c Tue Jan 4 09:48:21 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cd9660_write.c,v 1.13 2010/10/22 00:49:15 christos Exp $ */
+/* $NetBSD: cd9660_write.c,v 1.14 2011/01/04 09:48:21 wiz Exp $ */
/*
* Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660_write.c,v 1.13 2010/10/22 00:49:15 christos Exp $");
+__RCSID("$NetBSD: cd9660_write.c,v 1.14 2011/01/04 09:48:21 wiz Exp $");
#endif /* !__lint */
static int cd9660_write_volume_descriptors(FILE *);
@@ -460,6 +460,7 @@
if (ferror(rf)) {
warn("%s: fread", __func__);
free(buf);
+ (void)fclose(rf);
return 0;
}
@@ -467,6 +468,7 @@
if (ferror(fd)) {
warn("%s: fwrite", __func__);
free(buf);
+ (void)fclose(rf);
return 0;
}
sector++;