* event memory has to be not released when error happens
Change-Id: I53fe2d366069b773b6d9b05c052fa9ac56f85e0d
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
remains = get_data(&rotation_data, &data_length);
- if (remains < 0)
+ if (remains < 0) {
+ free(rotation_event);
return;
+ }
rotation_event->sensor_id = get_id();
rotation_event->event_type = AUTO_ROTATION_CHANGE_STATE_EVENT;
gravity_event->data = (sensor_data_t *)malloc(sizeof(sensor_data_t));
if (!gravity_event->data) {
_E("Failed to allocate memory");
+ free(gravity_event);
return;
}
gravity_event->data = (sensor_data_t *)malloc(sizeof(sensor_data_t));
if (!gravity_event->data) {
_E("Failed to allocate memory");
+ free(gravity_event);
return;
}
gravity_event->data = (sensor_data_t *)malloc(sizeof(sensor_data_t));
if (!gravity_event->data) {
_E("Failed to allocate memory");
+ free(gravity_event);
return;
}
remains = get_data(&linear_accel_data, &data_length);
- if (remains < 0)
+ if (remains < 0) {
+ free(linear_accel_event);
return;
+ }
linear_accel_event->sensor_id = get_id();
linear_accel_event->event_type = LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME;