Skip to content

Commit

Permalink
Fix memory leak in batmon (#1655)
Browse files Browse the repository at this point in the history
When the battery db saturates, `log_new_percentage` will leak the drop
statement each call.
  • Loading branch information
MattCatz authored Aug 31, 2024
1 parent 988dfcf commit d78c844
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/batmon/batmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ void log_new_percentage(int new_bat_value, int is_charging)
const char *delete_sql = "DELETE FROM bat_activity WHERE id = (SELECT MIN(id) FROM bat_activity);";
sqlite3_prepare_v2(bat_log_db, delete_sql, -1, &stmt, 0);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
}
}
close_battery_log_db();
Expand Down

0 comments on commit d78c844

Please sign in to comment.