A race condition exists between enumeration and reading of attributes. This is triggered in my case by the ACPI BIOS randomally making the battery disappear and reappear whilst transitioning between AC/Battery, it's much more likely to occur with multiple batteries due to the larger window. The actual cause of the crash: close_battery() is called after open_battery() fails, which obviously won't work since close_battery() attempts to free unallocated memory; glibc detects info[x] is an invalid pointer. Reproducible: Sometimes Steps to Reproduce: 1.Emerge cpufreqd with ACPI support 2.Use on an ACPI supported platform with one or more batteries (+ buggy bios?) 3.Insert or remove AC power Actual Results: cpufreqd daemon crashes Expected Results: Should not crash.
Created attachment 307007 [details, diff] Do not call close_battery() when open_battery() fails
dropped