Hi,

I may be missing something, but it looks to me like there could be a small memory leak in this bit of code from hal_device_added():

   /* HAL match rule: we look for pda.platform == 'palm'
    * (or the legacy info.bus == 'usb_device')
* and then try to match the usb_device.product_id and usb_device.vendor_id
    * against the list in devices.xml.
    */
if (platform = libhal_device_get_property_string (hal_ctx, udi, "pda.platform", NULL)) {
       if (strcmp (platform, "palm") != 0) {
       libhal_free_string (platform);
       return;
       }
} else if (bus = libhal_device_get_property_string (hal_ctx, udi, "info.bus", NULL)) {
       if (strcmp (bus, "usb_device") != 0) {
       libhal_free_string (bus);
       return;
       }
   } else {
       return;
   }


Specifically, libhal_free_string() is only called if pda.platform is not "palm", or info.bus is not "usb_device".

Would the following code be an improvement:
if (platform = libhal_device_get_property_string (hal_ctx, udi, "pda.platform", NULL)) {
       i = strcmp (platform, "palm");
       libhal_free_string (platform);
       if (i != 0)
           return;
   } else ....
        // same change for info.bus

(Note: I'm only using "i" here because its used in a similar way later in the function).


Cheers
Bruce


_______________________________________________
gnome-pilot-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-pilot-list

Reply via email to