Bug 14792

Summary: variable 'err' reused without reinitialising in addon-dell-backlight.cpp (patch attached)
Product: hal Reporter: Harry de Boer <harrydeboer>
Component: haldAssignee: David Zeuthen (not reading bugmail) <zeuthen>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
URL: https://bugs.launchpad.net/ubuntu/+bug/176687/
Whiteboard:
i915 platform: i915 features:
Attachments: Fix for addon-dell-brightness not checking err

Description Harry de Boer 2008-03-03 05:16:23 UTC
Created attachment 14784 [details] [review]
Fix for addon-dell-brightness not checking err

In addon-dell-backlight.cpp -> Get/SetBrightness the status of the ac_adapter.present is checked, but when the udi (/org/freedesktop/Hal/devices/acpi_AC) is not found the 'err' variable is set by the dbus call. Then, without checking if an error has occurred, the arguments from the original dbus call are read reusing 'err' which might not be properly intialised anymore (not 'null').

This results in not answering the dbus call which on the Gnome desktop hangs the gnome-power-manager for a while (including the brightness OSD).

The attached patch does the following:
* correctly free 'err' if it is set before reusing according to dbus spec.
* add check if udi for ac-adapter exists
* add check for udi as seen on dell inspiron 1501 (/org/freedesktop/Hal/devices/computer_power_supply)

The patch is against 0.5.10
Comment 1 Danny Kukawka 2008-03-04 04:45:46 UTC

*** This bug has been marked as a duplicate of bug 14797 ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.