ctsvc_base_s *base = (ctsvc_base_s*)contact;
ctsvc_base_s *clone = calloc(1, sizeof(ctsvc_base_s));
+ if (NULL == clone) {
+ /* LCOV_EXCL_START */
+ ERR("calloc() Fail");
+ return CONTACTS_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
+ }
clone->connection_count = base->connection_count;
clone->version = base->version;
contacts_record_set_str(name, _contacts_name.first, NULL); /* remove FN */
- while (true) {
+ do {
bool separator = false;
char *start_temp;
CTS_GET_MULTIPLE_COMPONENT(((ctsvc_name_s*)name)->suffix, start, start_temp, separator);
ERR("invalid name type");
- break;
- }
+ } while (0);
return CONTACTS_ERROR_NONE;
}
text = val;
}
- while (true) {
+ do {
bool separator = false;
CTS_GET_MULTIPLE_COMPONENT(((ctsvc_address_s*)address)->pobox, text, text_temp, separator);
CTS_GET_MULTIPLE_COMPONENT(((ctsvc_address_s*)address)->country, text, text_temp, separator);
ERR("invalid ADR type");
- break;
- }
+ } while (0);
if (((ctsvc_address_s*)address)->pobox || ((ctsvc_address_s*)address)->extended
|| ((ctsvc_address_s*)address)->street || ((ctsvc_address_s*)address)->locality
if (outdata) {
*outdata = pims_ipc_data_create(0);
- if (NULL == *outdata)
+ if (NULL == *outdata) {
/* LCOV_EXCL_START */
ERR("pims_ipc_data_create() Fail");
- goto DATA_FREE;
- /* LCOV_EXCL_STOP */
+ goto DATA_FREE;
+ /* LCOV_EXCL_STOP */
+ }
if (CONTACTS_ERROR_NONE != ctsvc_ipc_marshal_int(ret, *outdata)) {
/* LCOV_EXCL_START */
}
ret = ctsvc_ipc_unmarshal_int(indata, (int*)&op);
if (ret != CONTACTS_ERROR_NONE) {
+ /* LCOV_EXCL_START */
ERR("ctsvc_ipc_unmarshal_int() Fail");
goto ERROR_RETURN;
- if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_PHONELOG_WRITE)) {
- /* LCOV_EXCL_START */
- ret = CONTACTS_ERROR_PERMISSION_DENIED;
- goto ERROR_RETURN;
- /* LCOV_EXCL_STOP */
- }
+ /* LCOV_EXCL_STOP */
+ }
+ if (!ctsvc_have_permission(ipc, CTSVC_PERMISSION_PHONELOG_WRITE)) {
+ /* LCOV_EXCL_START */
+ ret = CONTACTS_ERROR_PERMISSION_DENIED;
+ goto ERROR_RETURN;
+ /* LCOV_EXCL_STOP */
}
switch (op) {
const char *temp_number;
const char *cc = ctsvc_get_network_cc(false);
+ RETV_IF(NULL == src, CONTACTS_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == dest, CONTACTS_ERROR_INVALID_PARAMETER);
+ RETV_IF(dest_size <= strlen(src), CONTACTS_ERROR_INVALID_PARAMETER);
+
if ('+' == src[0]) {
len = _numutil_has_country_code(&src[1], strlen(src)-1);
temp_number = src + len +1;
dest[len-i-1] = c;
}
} else {
- memcpy(dest, src, strlen(src));
- dest[strlen(src)] = 0;
+ memcpy(dest, src, strlen(src)+1);
}
return CONTACTS_ERROR_NONE;
DBG("%d", ret);
main_loop = g_main_loop_new(NULL, FALSE);
- pims_ipc_svc_run_main_loop(main_loop);
+ pims_ipc_svc_run_main_loop(&main_loop);
ctsvc_server_final_configuration();
ctsvc_server_bg_remove_cb();
if (NULL == __phone_log_chanaged_info) {
__phone_log_chanaged_info = calloc(CTSVC_SUBSCRIBE_MAX_LEN, sizeof(char));
+ if (NULL == __phone_log_chanaged_info) {
+ /* LCOV_EXCL_START */
+ ERR("calloc() Fail");
+ return;
+ /* LCOV_EXCL_STOP */
+ }
__phone_log_buf_size = CTSVC_SUBSCRIBE_MAX_LEN;
__phone_log_chanaged_info[0] = '\0';
}
if (NULL == __person_changed_info) {
__person_changed_info = calloc(CTSVC_SUBSCRIBE_MAX_LEN, sizeof(char));
+ if (NULL == __person_changed_info) {
+ /* LCOV_EXCL_START */
+ ERR("calloc() Fail");
+ return;
+ /* LCOV_EXCL_STOP */
+ }
__person_buf_size = CTSVC_SUBSCRIBE_MAX_LEN;
__person_changed_info[0] = '\0';
}
if (ctsvc_db_change()) {
ctsvc_set_phonelog_noti();
-
#ifdef _CONTACTS_IPC_SERVER
ctsvc_change_subject_add_changed_phone_log_id(CONTACTS_CHANGE_UPDATED, phonelog->id);
#endif
/* replace '-' -> '_' because FTS does not support search '-' */
tmp_len = strlen(search_keyword);
tmp_keyword = calloc(tmp_len + 1, sizeof(char));
+ if (NULL == tmp_keyword) {
+ /* LCOV_EXCL_START */
+ ERR("calloc() Fail");
+ mod_keyword = search_keyword;
+ break;
+ /* LCOV_EXCL_STOP */
+ }
for (i = 0; i < tmp_len; i++)
tmp_keyword[i] = ('-' == search_keyword[i]) ? '_' : search_keyword[i];
tmp_keyword[i] = '\0';
ret = ctsvc_normalize_number(clean_num, normal_num, sizeof(normal_num), false);
normal_num[sizeof(normal_num) -1] = '\0';
if (0 < ret) {
- char min_match[strlen(filter->value.s)+1+5]; /* for cc */
+ char min_match[sizeof(normal_num)+1]; /* for cc */
ret = ctsvc_get_minmatch_number(normal_num, min_match,
sizeof(min_match), ctsvc_get_phonenumber_min_match_digit());
if (CONTACTS_ERROR_NONE == ret) {
if (NULL == search_keyword) {
/* LCOV_EXCL_START */
ERR("__ctsvc_db_make_search_keyword() Fail");
+ if (use_replaced_keyword)
+ free(half_keyword);
return CONTACTS_ERROR_OUT_OF_MEMORY;
/* LCOV_EXCL_STOP */
}
/* replace '-' -> '_' because FTS does not support search '-' */
tmp_len = strlen(search_keyword);
tmp_keyword = calloc(tmp_len + 1, sizeof(char));
+ if (NULL == tmp_keyword) {
+ /* LCOV_EXCL_START */
+ ERR("calloc() Fail");
+ mod_keyword = search_keyword;
+ break;
+ /* LCOV_EXCL_STOP */
+ }
for (i = 0; i < tmp_len; i++)
tmp_keyword[i] = ('-' == search_keyword[i]) ? '_' : search_keyword[i];
tmp_keyword[i] = '\0';
int contact_id = 0;
char *display_name = NULL;
char *number = NULL;
- int snippet_type = NULL;
+ int snippet_type = 0;
char *snippet_string = NULL;
switch (uri_type) {
DBG("count(%d)", count);
int *ids = calloc(count, sizeof(int));
+ if (NULL == ids) {
+ ERR("calloc() Fail");
+ return;
+ }
int index = 0;
do {
contacts_record_h record = NULL;