summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Poole <netstar@gmail.com>2017-01-29 12:47:01 +0100
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-01-29 12:47:15 +0100
commit55a7d4feed1b94469e7fcbb94405f7451eb4185f (patch)
tree3014555634e9efcd758535640d99a85d5dca6312
parentabd60cca9aa3d411eb5f99972317d964256a3665 (diff)
downloadenlightenment-55a7d4feed1b94469e7fcbb94405f7451eb4185f.tar.gz
Fixes issues w/battery and batman living together
Summary: The problems were that both sysctl implementations defined public accessable fields named bat. The static definition moves into the file scopes. The E_FREE calls are fixing a use after free. Reviewers: zmike!, bu5hm4n Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D4629
-rw-r--r--src/modules/battery/e_mod_sysctl.c18
-rw-r--r--src/modules/sysinfo/batman/batman_sysctl.c4
2 files changed, 11 insertions, 11 deletions
diff --git a/src/modules/battery/e_mod_sysctl.c b/src/modules/battery/e_mod_sysctl.c
index e84ccf1eec..3cbeb30a2a 100644
--- a/src/modules/battery/e_mod_sysctl.c
+++ b/src/modules/battery/e_mod_sysctl.c
@@ -18,8 +18,8 @@ extern Eina_List *device_batteries;
extern Eina_List *device_ac_adapters;
extern double init_time;
-Ac_Adapter *ac = NULL;
-Battery *bat = NULL;
+static Ac_Adapter *ac = NULL;
+static Battery *bat = NULL;
int
_battery_sysctl_start(void)
@@ -138,8 +138,8 @@ _battery_sysctl_stop(void)
if (ac)
{
eina_stringshare_del(ac->udi);
- free(ac->mib);
- free(ac);
+ E_FREE(ac->mib);
+ E_FREE(ac);
}
if (bat)
@@ -150,12 +150,12 @@ _battery_sysctl_stop(void)
eina_stringshare_del(bat->vendor);
ecore_poller_del(bat->poll);
#if defined(__FreeBSD__) || defined(__DragonFly__)
- free(bat->mib_state);
- free(bat->mib_time);
- free(bat->mib_units);
+ E_FREE(bat->mib_state);
+ E_FREE(bat->mib_time);
+ E_FREE(bat->mib_units);
#endif
- free(bat->mib);
- free(bat);
+ E_FREE(bat->mib);
+ E_FREE(bat);
}
}
diff --git a/src/modules/sysinfo/batman/batman_sysctl.c b/src/modules/sysinfo/batman/batman_sysctl.c
index 7e1fc681b6..57d3d46b08 100644
--- a/src/modules/sysinfo/batman/batman_sysctl.c
+++ b/src/modules/sysinfo/batman/batman_sysctl.c
@@ -18,8 +18,8 @@ extern Eina_List *batman_device_batteries;
extern Eina_List *batman_device_ac_adapters;
extern double batman_init_time;
-Ac_Adapter *ac = NULL;
-Battery *bat = NULL;
+static Ac_Adapter *ac = NULL;
+static Battery *bat = NULL;
int
_batman_sysctl_start(Instance *inst)