[patch] fd leak in usb_proc_parse

Sjoerd Simons sjoerd at luon.net
Sat Sep 18 12:53:56 PDT 2004


Hi,

  usb_proc_parse() parses /proc/bus/usb/devices but never closes the FILE
  struct, which obviously leads to a fd leak. Fixed in attached patch.
 
  Sjoerd
-- 
Order and simplification are the first steps toward mastery of a subject
-- the actual enemy is the unknown.
		-- Thomas Mann
-------------- next part --------------
Index: hald/linux/usb_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/usb_bus_device.c,v
retrieving revision 1.12
diff -u -r1.12 usb_bus_device.c
--- hald/linux/usb_bus_device.c	9 Aug 2004 18:33:29 -0000	1.12
+++ hald/linux/usb_bus_device.c	18 Sep 2004 19:50:07 -0000
@@ -487,6 +487,7 @@
 		fgets (buf, 256, f);
 		usb_proc_parse_line (buf);
 	}
+	fclose(f);
 	usb_proc_device_done (usb_proc_cur_info);
 
 /*
-------------- next part --------------
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal


More information about the Hal mailing list