Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/videomode Fix fd leaks. Found by cppcheck.
details: https://anonhg.NetBSD.org/src/rev/be1a65caf2dc
branches: trunk
changeset: 760409:be1a65caf2dc
user: wiz <wiz%NetBSD.org@localhost>
date: Tue Jan 04 10:32:34 2011 +0000
description:
Fix fd leaks. Found by cppcheck.
diffstat:
usr.sbin/videomode/videomode.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (36 lines):
diff -r b1a138d884bd -r be1a65caf2dc usr.sbin/videomode/videomode.c
--- a/usr.sbin/videomode/videomode.c Tue Jan 04 10:30:21 2011 +0000
+++ b/usr.sbin/videomode/videomode.c Tue Jan 04 10:32:34 2011 +0000
@@ -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
Home |
Main Index |
Thread Index |
Old Index