eeze/sensor: Fix big memleak that happened on every eeze use.
Really free the list with sensor modules when shutting down. No idea how I dropped that as I found it in one old local version I had. Thanks to Mike for the notice and valgrind for the tooling. Also make sure we don't corrupt the list before we can free it. SVN revision: 77291
This commit is contained in:
parent
13110e7610
commit
7032a54a09
|
@ -41,7 +41,7 @@ EAPI Eeze_Sensor_Obj *
|
||||||
eeze_sensor_obj_get(Eeze_Sensor_Type sensor_type)
|
eeze_sensor_obj_get(Eeze_Sensor_Type sensor_type)
|
||||||
{
|
{
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
Eeze_Sensor_Obj *obj;
|
Eeze_Sensor_Obj *obj, *sens;
|
||||||
Eeze_Sensor_Module *module;
|
Eeze_Sensor_Module *module;
|
||||||
|
|
||||||
module = _highest_priority_module_get();
|
module = _highest_priority_module_get();
|
||||||
|
@ -52,7 +52,12 @@ eeze_sensor_obj_get(Eeze_Sensor_Type sensor_type)
|
||||||
{
|
{
|
||||||
if (obj->type == sensor_type)
|
if (obj->type == sensor_type)
|
||||||
{
|
{
|
||||||
return obj;
|
sens = calloc(1, sizeof(Eeze_Sensor_Obj));
|
||||||
|
if (!sens) return NULL;
|
||||||
|
|
||||||
|
memcpy(sens, obj, sizeof(Eeze_Sensor_Obj));
|
||||||
|
|
||||||
|
return sens;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -168,7 +168,12 @@ sensor_fake_init(void)
|
||||||
void
|
void
|
||||||
sensor_fake_shutdown(void)
|
sensor_fake_shutdown(void)
|
||||||
{
|
{
|
||||||
|
Eeze_Sensor_Obj *sens;
|
||||||
|
|
||||||
eeze_sensor_module_unregister("fake");
|
eeze_sensor_module_unregister("fake");
|
||||||
|
EINA_LIST_FREE(esensor_module->sensor_list, sens)
|
||||||
|
free(sens);
|
||||||
|
|
||||||
free(esensor_module);
|
free(esensor_module);
|
||||||
esensor_module = NULL;
|
esensor_module = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -781,9 +781,14 @@ sensor_tizen_init(void)
|
||||||
void
|
void
|
||||||
sensor_tizen_shutdown(void)
|
sensor_tizen_shutdown(void)
|
||||||
{
|
{
|
||||||
|
Eeze_Sensor_Obj *sens;
|
||||||
|
|
||||||
sensor_stop(sensor_handle, SENSOR_MOTION_FACEDOWN);
|
sensor_stop(sensor_handle, SENSOR_MOTION_FACEDOWN);
|
||||||
sensor_stop(sensor_handle, SENSOR_MOTION_DOUBLETAP);
|
sensor_stop(sensor_handle, SENSOR_MOTION_DOUBLETAP);
|
||||||
eeze_sensor_module_unregister("tizen");
|
eeze_sensor_module_unregister("tizen");
|
||||||
|
EINA_LIST_FREE(esensor_module->sensor_list, sens)
|
||||||
|
free(sens);
|
||||||
|
|
||||||
free(esensor_module);
|
free(esensor_module);
|
||||||
esensor_module = NULL;
|
esensor_module = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue