if (ret)
goto FINISH;
- node = g_malloc0(sizeof(focus_node_t));
+ node = (focus_node_t *)g_try_malloc0(sizeof(focus_node_t));
+ if (!node) {
+ debug_error("Failed to alloc node");
+ ret = MM_ERROR_OUT_OF_MEMORY;
+ goto FINISH;
+ }
/* fill up information to the node */
_mm_sound_mgr_focus_fill_info_from_msg(node, param);
}
}
- node = g_malloc0(sizeof(focus_node_t));
+ node = (focus_node_t *)g_try_malloc0(sizeof(focus_node_t));
+ if (!node) {
+ debug_error("Failed to alloc node");
+ ret = MM_ERROR_OUT_OF_MEMORY;
+ goto FINISH;
+ }
/* fill up information to the node */
_mm_sound_mgr_focus_fill_info_from_msg(node, param);
#define GET_CB_DATA(_cb_data, _func, _userdata, _extradata) \
do { \
- _cb_data = (struct callback_data*) g_malloc0(sizeof(struct callback_data)); \
+ _cb_data = (struct callback_data*) g_try_malloc0(sizeof(struct callback_data)); \
+ if (!_cb_data) { \
+ debug_error("failed to allocate callback_data"); \
+ return MM_ERROR_OUT_OF_MEMORY; \
+ } \
_cb_data->user_cb = _func; \
_cb_data->user_data = _userdata; \
_cb_data->extra_data = _extradata; \
getpid(), handle, stream_type, stream_id);
if (ret != MM_ERROR_NONE) {
debug_error("Play Sound Failed");
- goto failed;
+ return ret;
}
if (param->callback) {
- end_cb_data = (play_sound_end_callback_data_t *) g_malloc0(sizeof(play_sound_end_callback_data_t));
+ end_cb_data = (play_sound_end_callback_data_t *) g_try_malloc0(sizeof(play_sound_end_callback_data_t));
+ if (!end_cb_data) {
+ debug_error("Failed to alloc end_cb_data");
+ return MM_ERROR_OUT_OF_MEMORY;
+ }
end_cb_data->watching_handle = *handle;
GET_CB_DATA(cb_data, param->callback, param->data, end_cb_data);
debug_error("Add callback for play sound(%d) Failed", *handle);
}
-failed:
-
debug_fleave();
return ret;
default:
err = MM_ERROR_SOUND_INTERNAL;
goto fail;
- break;
}
if (!s) {
}
handle = (mm_sound_handle_t *) malloc(sizeof(mm_sound_handle_t));
+ if (!handle) {
+ debug_error("Failed to alloc handle");
+ err = MM_ERROR_OUT_OF_MEMORY;
+ goto fail;
+ }
memset(handle, 0, sizeof(mm_sound_handle_t));
handle->mode = mode;
handle->volume_type = prop_vol_type;
#define CB_DATA_NEW(_cb_data, _func, _userdata, _freefunc) \
do { \
- _cb_data = (struct callback_data*) g_malloc0(sizeof(struct callback_data)); \
+ _cb_data = (struct callback_data*) g_try_malloc0(sizeof(struct callback_data)); \
+ if (!_cb_data) { \
+ debug_error("failed to allocate callback_data"); \
+ return MM_ERROR_OUT_OF_MEMORY; \
+ } \
_cb_data->user_cb = _func; \
_cb_data->user_data = _userdata; \
_cb_data->free_func = _freefunc; \
Name: libmm-sound
Summary: MMSound Package contains client lib and sound_server binary
-Version: 0.12.58
+Version: 0.12.59
Release: 0
Group: System/Libraries
License: Apache-2.0