tid_list = (int *)realloc(tid_list, alloc_count * sizeof(pid_t));
if (tid_list == NULL) {
_E("[CPU-BOOSTING] Failed to allocate memory");
+ closedir(dir);
+ resource_pid->tid = NULL;
+ resource_pid->tid_count = 0;
return RESOURCED_ERROR_OUT_OF_MEMORY;
}
}
/* Check body size */
if (input->client_input.body_len > 0 &&
input->client_input.pid.tid_count > 0) {
- int *tid_list;
+ pid_t *tid_list;
int body_len = input->client_input.body_len;
- int tid_count = input->client_input.pid.tid_count;
- tid_list = (int *)calloc(tid_count, sizeof(int));
+ tid_list = (pid_t *)calloc(1, body_len);
if (tid_list == NULL) {
_E("[CPU-BOOSTING] Failed to allocate memory");
ret = RESOURCED_ERROR_OUT_OF_MEMORY;
char appname[PROC_NAME_MAX];
pid_t sender_pid = siginfo->si_pid;
- proc_get_cmdline(sender_pid, appname, sizeof(appname));
- _D("signal = %d sender pid = %d (%s)", sig, sender_pid, appname);
+ if (proc_get_cmdline(sender_pid, appname, sizeof(appname)) < 0)
+ _D("signal = %d sender pid = %d", sig, sender_pid);
+ else
+ _D("signal = %d sender pid = %d (%s)", sig, sender_pid, appname);
resourced_quit_mainloop();
}
static void add_signal_handler(void)
{
- struct sigaction sig_act;
+ struct sigaction sig_act = {0,};
sig_act.sa_sigaction = sig_term_handler;
sig_act.sa_flags = 0;