[patch] fix fd/memleak when fs detection fails

Sjoerd Simons sjoerd at luon.net
Fri May 21 02:52:20 PDT 2004


Hi,

  When fs detection fails the volume_id struct wasn't closed, causing a mem and
  fd leak. And as a side effect, causing me to be unable to open my cd writer
  with the eject button when there was a blank cd inside :) 

  Attached patch fixes this.

  Sjoerd
-- 
Only that in you which is me can hear what I'm saying.
		-- Baba Ram Dass
-------------- next part --------------
Index: hald/linux/block_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/block_class_device.c,v
retrieving revision 1.22
diff -u -r1.22 block_class_device.c
--- a/hald/linux/block_class_device.c	13 May 2004 21:21:32 -0000	1.22
+++ b/hald/linux/block_class_device.c	21 May 2004 09:37:27 -0000
@@ -761,8 +761,10 @@
 		return;
 
 	rc = volume_id_probe(vid, ALL);
-	if (rc != 0)
+	if (rc != 0) {
+		volume_id_close(vid);
 		return;
+	}
 
 	hal_device_property_set_string (d, "volume.fstype", vid->fs_name);
 	if (vid->label_string[0] != '\0')
-------------- next part --------------
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal


More information about the Hal mailing list