From bd42aea68a96dfdd6e66d22332c6f185ca7ac6ad Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Thu, 13 Dec 2018 15:01:18 +0300 Subject: [PATCH] Check malloc result --- proc_stat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proc_stat.c b/proc_stat.c index 1fc53f2..ead44a1 100644 --- a/proc_stat.c +++ b/proc_stat.c @@ -311,6 +311,9 @@ pthread_t start_write_proc_stat(FILE *output, int pid, int timeout_usec, int ver } struct outstat_info *oi = malloc(sizeof(struct outstat_info)); + if (oi == NULL) { + log_system_error_and_exit("malloc(sizeof(struct outstat_info))"); + } oi->file = output; oi->pid = pid; oi->timeout_usec = timeout_usec; -- 2.34.1