Re: [hackers] [scron] [PATCH 2/3] Handle out-of-memory

From: Lucas Gabriel Vuotto <lvuotto92_AT_gmail.com>
Date: Tue, 11 Jul 2017 11:20:32 -0300

This estrdup wasn't changed, potentially generating a segfault (if the codes somehow keeps going on) at line 140 of the current, unpatched code.

> _AT_@ -157,7 +149,8 @@ runjob(char *cmd)
> cmd, ctime(&t));
> _exit(EXIT_FAILURE);
> } else {
> - je = emalloc(sizeof(*je));
> + if (!(je = emalloc(sizeof(*je))))
> + return;
> je->cmd = estrdup(cmd);
> je->pid = pid;
> je->next = jobs;

Also, I don't see the point on keeping emalloc as it is given this changes. It should be renamed to xmalloc (because it doesn't error out at anymore) or completely deleted.
Received on Tue Jul 11 2017 - 16:20:32 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 11 2017 - 16:24:57 CEST