[PATCH] fix uninitialised memory usage in pci_add

Rob Taylor rob.taylor at codethink.co.uk
Thu Nov 8 15:51:47 PST 2007


pci_add was using vendor_name, product_name, subsys_vendor_name and
subsys_product_name unitialised, causing random crashes and garbage output.
---
 hald/linux/device.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hald/linux/device.c b/hald/linux/device.c
index 7111629..32063bd 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -1551,10 +1551,10 @@ pci_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
 
 	{
 		gchar buf[64];
-		char *vendor_name;
-		char *product_name;
-		char *subsys_vendor_name;
-		char *subsys_product_name;
+		char *vendor_name = NULL;
+		char *product_name = NULL;
+		char *subsys_vendor_name = NULL;
+		char *subsys_product_name = NULL;
 
 		ids_find_pci (hal_device_property_get_int (d, "pci.vendor_id"), 
 			      hal_device_property_get_int (d, "pci.product_id"), 
-- 
1.5.3.GIT


--------------000303050506080805030300--


More information about the hal mailing list