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
devs/bu5hm4n/mixer_fix_range
Al Poole 6 years ago committed by Marcel Hollerbach
parent abd60cca9a
commit 55a7d4feed
  1. 18
      src/modules/battery/e_mod_sysctl.c
  2. 4
      src/modules/sysinfo/batman/batman_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);
}
}

@ -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)

Loading…
Cancel
Save