return MM_ERROR_SOUND_INTERNAL;
}
- cb_data = (struct callback_data*) g_malloc0(sizeof(struct callback_data));
+ if (!(cb_data = (struct callback_data*) g_malloc0(sizeof(struct callback_data)))) {
+ debug_error("Allocate for callback data failed");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
cb_data->user_cb = callback;
cb_data->user_data = userdata;
cb_data->free_func = freefunc;
return MM_ERROR_NONE;
fail:
- if (cb_data)
- free(cb_data);
+ free(cb_data);
return MM_ERROR_SOUND_INTERNAL;
}
static void _mm_sound_stop_callback_wrapper_func(int ended_handle, void *userdata)
{
struct callback_data *cb_data = (struct callback_data*) userdata;
- play_sound_end_callback_data_t *end_cb_data = (play_sound_end_callback_data_t*) cb_data->extra_data;
+ play_sound_end_callback_data_t *end_cb_data;
debug_log("[Wrapper CB][Play Stop] ended_handle : %d", ended_handle);
debug_warning("stop callback data null");
return;
}
+
+ end_cb_data = (play_sound_end_callback_data_t*) cb_data->extra_data;
+
if (ended_handle == end_cb_data->watching_handle) {
debug_log("Interested playing handle end : %d", ended_handle);
((mm_sound_stop_callback_func)(cb_data->user_cb))(cb_data->user_data, ended_handle);
{
mm_sound_device_t device_h;
struct callback_data *cb_data = (struct callback_data*) userdata;
- int device_flags = (int) cb_data->extra_data;
+ int device_flags;
debug_log("[Wrapper CB][Device Connnected] device_id : %d, device_type : %s, direction : %d, state : %d, name : %s, is_connected : %d",
device_id, device_type, io_direction, state, name, is_connected);
debug_warning("device connected changed callback data null");
return;
}
+
+ device_flags = (int) cb_data->extra_data;
+
if (!is_device_match_flags(device_type, io_direction, state, device_flags))
return;
{
mm_sound_device_t device_h;
struct callback_data *cb_data = (struct callback_data*) userdata;
- int device_flags = (int) cb_data->extra_data;
+ int device_flags;
debug_log("[Wrapper CB][Device Info Changed] device_id : %d, device_type : %s, direction : %d, state : %d, name : %s, changed_info_type : %d",
device_id, device_type, io_direction, state, name, changed_device_info_type);
debug_warning("device info changed callback data null");
return;
}
+
+ device_flags = (int) cb_data->extra_data;
+
if (!is_device_match_flags(device_type, io_direction, state, device_flags))
return;