[patch] fd leak fix for {pci,id} reading

Sjoerd Simons sjoerd at luon.net
Sun Oct 10 10:25:22 PDT 2004


On Thu, Oct 07, 2004 at 04:30:47PM +0200, Sjoerd Simons wrote:
> Hi,
> 
>   The {pci, usb} id database read functions never close the file descriptors. 
>   bad.  Fixed in attached patch

    The patch was missing the usb db part. Now attached

      Sjoerd
-- 
Why don't you fix your little problem... and light this candle?
		-- Alan Shepherd, the first man into space, Gemini program
-------------- next part --------------
Index: hald/linux/usb_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/usb_bus_device.c,v
retrieving revision 1.14
diff -u -r1.14 usb_bus_device.c
--- hald/linux/usb_bus_device.c	20 Sep 2004 18:31:15 -0000	1.14
+++ hald/linux/usb_bus_device.c	10 Oct 2004 17:22:19 -0000
@@ -237,6 +237,7 @@
 		printf
 		    ("Couldn't allocate %d bytes for USB database file\n",
 		     usb_ids_len);
+		fclose(fp);
 		return FALSE;
 	}
 
@@ -245,9 +246,11 @@
 		printf ("Error loading USB database file\n");
 		free (usb_ids);
 		usb_ids = NULL;
+		fclose(fp);
 		return FALSE;
 	}
 
+	fclose(fp);
 	return TRUE;
 }
 
-------------- next part --------------
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal


More information about the Hal mailing list