summaryrefslogtreecommitdiff
path: root/platform/x11
diff options
context:
space:
mode:
authorqarmin <mikrutrafal54@gmail.com>2019-07-23 09:14:31 +0200
committerqarmin <mikrutrafal54@gmail.com>2019-07-23 09:14:31 +0200
commitaab8da25ad2c3e6d2df03abbc8e35c1725938c40 (patch)
treea98f3ddd124571378b146209beb308eb2768f9bc /platform/x11
parente466dc2daa8eee7e6fb5a7fce40bf9e988a927cb (diff)
Fix some code found by Coverity Scan and PVS Studio
Diffstat (limited to 'platform/x11')
-rw-r--r--platform/x11/joypad_linux.cpp2
-rw-r--r--platform/x11/power_x11.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/platform/x11/joypad_linux.cpp b/platform/x11/joypad_linux.cpp
index e6328ee14d..4242952374 100644
--- a/platform/x11/joypad_linux.cpp
+++ b/platform/x11/joypad_linux.cpp
@@ -513,6 +513,8 @@ void JoypadLinux::process_joypads() {
break;
default:
+ if (ev.code >= MAX_ABS)
+ return;
if (joy->abs_map[ev.code] != -1 && joy->abs_info[ev.code]) {
InputDefault::JoyAxis value = axis_correct(joy->abs_info[ev.code], ev.value);
joy->curr_axis[joy->abs_map[ev.code]] = value;
diff --git a/platform/x11/power_x11.cpp b/platform/x11/power_x11.cpp
index 758bd84114..c33c77e16b 100644
--- a/platform/x11/power_x11.cpp
+++ b/platform/x11/power_x11.cpp
@@ -268,9 +268,7 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() {
check_proc_acpi_battery(node.utf8().get_data(), &have_battery, &charging /*, seconds, percent*/);
node = dirp->get_next();
}
- memdelete(dirp);
}
-
dirp->change_dir(proc_acpi_ac_adapter_path);
err = dirp->list_dir_begin();
if (err != OK) {
@@ -281,7 +279,6 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() {
check_proc_acpi_ac_adapter(node.utf8().get_data(), &have_ac);
node = dirp->get_next();
}
- memdelete(dirp);
}
if (!have_battery) {
@@ -294,6 +291,7 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() {
this->power_state = OS::POWERSTATE_ON_BATTERY;
}
+ memdelete(dirp);
return true; /* definitive answer. */
}