bool __get_caller_unique_name(int pid, char *unique_name, bool *is_app, uid_t uid)
{
char caller_appid[256] = {0,};
+ appid_cache_t* entry;
if (unique_name == NULL) {
ALARM_MGR_EXCEPTION_PRINT("unique_name should not be NULL.");
strncpy(unique_name, process_name, strlen(process_name));
}
}
- appid_cache_t* entry = (appid_cache_t*)calloc(1, sizeof(appid_cache_t));
- entry->unique_name = strdup(unique_name);
- entry->is_app = is_app ? *is_app : false;
- entry->pid = pid;
g_hash_table_foreach_remove(appid_cache_table, __hash_table_remove_cb, (gpointer)unique_name);
- g_hash_table_insert(appid_cache_table, &entry->pid, (gpointer)entry);
+ entry = (appid_cache_t*)calloc(1, sizeof(appid_cache_t));
+ if (entry) {
+ entry->unique_name = strdup(unique_name);
+ entry->is_app = is_app ? *is_app : false;
+ entry->pid = pid;
+ g_hash_table_insert(appid_cache_table, &entry->pid, (gpointer)entry);
+ }
SECURE_LOGD("unique_name= %s", unique_name);
return true;
g_type_init();
#endif
param = g_try_new0(struct alarm_async_param_t, 1);
+ if (param == NULL) {
+ ALARM_MGR_EXCEPTION_PRINT("Failed to alloc param");
+ return ERR_ALARM_SYSTEM_FAIL;
+ }
param->type = SET_SYSTIME;
param->v = g_variant_new("i", new_time);
param->result_cb = result_cb;
g_type_init();
#endif
param = g_try_new0(struct alarm_async_param_t, 1);
+ if (param == NULL) {
+ ALARM_MGR_EXCEPTION_PRINT("Failed to alloc param");
+ return ERR_ALARM_SYSTEM_FAIL;
+ }
param->type = SET_SYSTIME_WITH_PROPAGATION_DELAY;
param->v = g_variant_new("(uuuu)", new_time.tv_sec, new_time.tv_nsec,
req_time.tv_sec, req_time.tv_nsec);