eta.c: check malloc return code
authorRobert Elliott <elliott@hp.com>
Sat, 13 Dec 2014 04:50:30 +0000 (21:50 -0700)
committerJens Axboe <axboe@fb.com>
Sat, 13 Dec 2014 04:50:30 +0000 (21:50 -0700)
Check the malloc return code in get_jobs_eta.

Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
eta.c

diff --git a/eta.c b/eta.c
index a90f1fb4763758eaedc9130036a2d60b720fc9bc..167bf5f62b215d470e1f41d1ee95ba75968589cd 100644 (file)
--- a/eta.c
+++ b/eta.c
@@ -572,6 +572,8 @@ struct jobs_eta *get_jobs_eta(int force, size_t *size)
 
        *size = sizeof(*je) + THREAD_RUNSTR_SZ;
        je = malloc(*size);
+       if (!je)
+               return NULL;
        memset(je, 0, *size);
 
        if (!calc_thread_status(je, force)) {