Hi friends,

here is another issue (spotted out by cppcheck, a static code analysis tool).

It prints the following warning:

../xfree86/common/xf86Configure.c,266,possible error,Resource leak: fd

Take a look into file xf86Configure.c at line 266:

...
        fd = open("/dev/wsmouse", 0);
        if (fd > 0) {
            DFLT_MOUSE_DEV = "/dev/wsmouse";
            DFLT_MOUSE_PROTO = "wsmouse";
            close(fd);
        } else {
            ErrorF("cannot open /dev/wsmouse\n");
        }
...

As you can see, the if()-statement is wrong because open returns the 
filepointer or, in case of an error -1 !! See the attached patch that corrects 
that issue.

Best regards

Martin



-- 
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index bce5aae..3b7828a 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -253,7 +253,7 @@ configureInputSection (void)
 	int fd;
 #ifdef WSCONS_SUPPORT
 	fd = open("/dev/wsmouse", 0);
-	if (fd > 0) {
+	if (fd >= 0) {
 	    DFLT_MOUSE_DEV = "/dev/wsmouse";
 	    DFLT_MOUSE_PROTO = "wsmouse";
 	    close(fd);
_______________________________________________
xorg-devel mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to