From: Zbigniew Jędrzejewski-Szmek Date: Sat, 14 Mar 2015 02:21:52 +0000 (-0500) Subject: core: check asprintf return value X-Git-Tag: v219.0~329 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=d6483ba7834b9e63caee929c9d6373b796be1b21;p=elogind.git core: check asprintf return value CID #1261729. --- diff --git a/src/core/manager.c b/src/core/manager.c index 24a66a28a..d92e048e2 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -178,8 +178,10 @@ static void manager_print_jobs_in_progress(Manager *m) { m->jobs_in_progress_iteration++; - if (m->n_running_jobs > 1) - asprintf(&job_of_n, "(%u of %u) ", counter, m->n_running_jobs); + if (m->n_running_jobs > 1) { + 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); if (job_get_timeout(j, &x) > 0)