core: check asprintf return value

CID #1261729.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2015-03-13 21:21:52 -05:00
parent e64d523579
commit d6483ba783

View file

@ -178,8 +178,10 @@ static void manager_print_jobs_in_progress(Manager *m) {
m->jobs_in_progress_iteration++; m->jobs_in_progress_iteration++;
if (m->n_running_jobs > 1) if (m->n_running_jobs > 1) {
asprintf(&job_of_n, "(%u of %u) ", counter, m->n_running_jobs); if (asprintf(&job_of_n, "(%u of %u) ", counter, m->n_running_jobs) < 0)
job_of_n = NULL;
}
format_timespan(time, sizeof(time), now(CLOCK_MONOTONIC) - j->begin_usec, 1*USEC_PER_SEC); format_timespan(time, sizeof(time), now(CLOCK_MONOTONIC) - j->begin_usec, 1*USEC_PER_SEC);
if (job_get_timeout(j, &x) > 0) if (job_get_timeout(j, &x) > 0)