From 55162556823bc1f6878609c0d8de8cbaf9608d43 Mon Sep 17 00:00:00 2001 From: Jason Andryuk Date: Tue, 4 Oct 2022 08:18:09 -0400 Subject: [PATCH] xcpmd: Fix double closedir() commit a7fab046cb3c "xcpmd: unify update_battery_info/status" broke xcpmd startup. It aborts with: double free or corruption (top) When update_battery_info() and update_battery_status() were merged, the two closedir() calls were retained. Only one call is correct. Remove the second that leads to the abort(). Fixed: a7fab046cb3c "xcpmd: unify update_battery_info/status" Signed-off-by: Jason Andryuk --- xcpmd/src/battery.c | 1 - 1 file changed, 1 deletion(-) diff --git a/xcpmd/src/battery.c b/xcpmd/src/battery.c index 7805452d..1d651d3e 100644 --- a/xcpmd/src/battery.c +++ b/xcpmd/src/battery.c @@ -572,7 +572,6 @@ int update_battery_status(unsigned int battery_index) { status.remaining_capacity = status.energy_now; } - closedir(battery_dir); memcpy(&last_status[battery_index], &status, sizeof(struct battery_status)); #ifdef XCPMD_DEBUG print_battery_status(battery_index);