cert_info = (struct datacontrol_cert_info *)calloc(1,
sizeof(struct datacontrol_cert_info));
+ if (cert_info == NULL) {
+ _LOGE("out of memory.");
+ return;
+ }
if (is_map)
cert_info->map = status;
datacontrol_consumer_request_info *request_info =
(datacontrol_consumer_request_info *)calloc(
sizeof(datacontrol_consumer_request_info), 1);
+ if (request_info == NULL) {
+ _LOGE("out of memory.");
+ return DATA_CONTROL_ERROR_OUT_OF_MEMORY;
+ }
+
request_info->request_id = request_id;
request_info->type = type;
_dc_returned->request_info_list =
char *_get_encoded_path(data_control_h provider, char *consumer_appid)
{
int prefix_len = strlen(DATA_CONTROL_DBUS_PATH_PREFIX);
- char *encoded_path;
- char *full_path;
+ char *encoded_path = NULL;
+ char *full_path = NULL;
int path_len = strlen(provider->provider_id) +
strlen(provider->data_id) + strlen(consumer_appid) + 3;
int full_path_len = path_len + prefix_len;
char *path = (char *)calloc(path_len, sizeof(char));
if (path == NULL) {
_LOGE("path calloc failed");
- return 0;
+ return NULL;
}
snprintf(path, path_len, "%s_%s_%s", provider->provider_id,
encoded_path = g_compute_checksum_for_string(G_CHECKSUM_MD5, path, -1);
full_path = (char *)calloc(full_path_len, sizeof(char));
+ if (full_path == NULL) {
+ _LOGE("out of memory.");
+ goto out;
+ }
+
snprintf(full_path, full_path_len, "%s%s",
DATA_CONTROL_DBUS_PATH_PREFIX, encoded_path);
-
- free(path);
- free(encoded_path);
+out:
+ if (path)
+ free(path);
+ if (encoded_path)
+ free(encoded_path);
_LOGI("full path : %s ", full_path);
return full_path;
}
result_cb_info =
(add_callback_result_cb_info_s *)calloc(1, sizeof(add_callback_result_cb_info_s));
+ if (result_cb_info == NULL) {
+ _LOGE("out of memory.");
+ ret = DATA_CONTROL_ERROR_OUT_OF_MEMORY;
+ goto err;
+ }
result_cb_info->callback_id = *callback_id;
result_cb_info->callback = result_callback;
result_cb_info->user_data = result_cb_user_data;
consumer_info = (datacontrol_consumer_info *)
calloc(1, sizeof(datacontrol_consumer_info));
+ if (consumer_info == NULL) {
+ _LOGE("out of memory.");
+ ret = DATA_CONTROL_ERROR_OUT_OF_MEMORY;
+ break;
+ }
+
consumer_info->appid = strdup(app_id);
consumer_info->object_path = strdup(object_path);
consumer_info->unique_id = strdup(unique_id);
if (!find_list) {
consumer_info = (datacontrol_consumer_info *)
calloc(1, sizeof(datacontrol_consumer_info));
+ if (consumer_info == NULL) {
+ _LOGE("out of memory.");
+ return DATA_CONTROL_ERROR_OUT_OF_MEMORY;
+ }
+
consumer_info->appid = strdup(caller);
consumer_info->object_path = strdup(object_path);
consumer_info->unique_id = strdup(unique_id);
changed_noti_consumer_filter_info_s *filter_info =
(changed_noti_consumer_filter_info_s *)calloc(1, sizeof(changed_noti_consumer_filter_info_s));
+ if (filter_info == NULL) {
+ _LOGE("out of memory.");
+ return DATA_CONTROL_ERROR_OUT_OF_MEMORY;
+ }
*callback_id = __datacontrol_get_data_changed_filter_callback_id();
total_arg_count = column_count + DATACONTROL_SELECT_EXTRA_COUNT;
arg_list = (const char **)malloc(total_arg_count * (sizeof(char *)));
+ if (arg_list == NULL) {
+ _LOGE("out of memory.");
+ bundle_free(b);
+ return DATA_CONTROL_ERROR_OUT_OF_MEMORY;
+ }
_LOGI("total arg count %d", total_arg_count);