Module Name: src
Committed By: wiz
Date: Tue Jan 4 10:32:34 UTC 2011
Modified Files:
src/usr.sbin/videomode: videomode.c
Log Message:
Fix fd leaks. Found by cppcheck.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/videomode/videomode.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/videomode/videomode.c
diff -u src/usr.sbin/videomode/videomode.c:1.7 src/usr.sbin/videomode/videomode.c:1.8
--- src/usr.sbin/videomode/videomode.c:1.7 Sat Jan 17 22:01:32 2009
+++ src/usr.sbin/videomode/videomode.c Tue Jan 4 10:32:34 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: videomode.c,v 1.7 2009/01/17 22:01:32 he Exp $ */
+/* $NetBSD: videomode.c,v 1.8 2011/01/04 10:32:34 wiz Exp $ */
/*
* Copyright (c) 1995 Christian E. Hopps
@@ -132,14 +132,17 @@
dump_vm(&vm);
(void)printf("\n");
}
- if (m >= 0)
+ if (m >= 0) {
+ (void)close(grffd);
return;
+ }
for (m = 1; m <= num_vm; m++) {
vm.mode_num = m;
if (ioctl(grffd, GRFGETVMODE, &vm) == -1)
break;
dump_vm(&vm);
}
+ (void)close(grffd);
}
void
@@ -150,6 +153,7 @@
grffd = get_grf();
(void)ioctl(grffd, GRFSETVMODE, &m);
+ (void)close(grffd);
}
void