On Thu, May 03, 2018 at 02:49:03PM +0800, Nan Xiao wrote:

> Hi tech@,
> 
> A patch for usr.bin/systat/vmstat.c, apologize if I'm wrong.
> 
> Index: vmstat.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/systat/vmstat.c,v
> retrieving revision 1.82
> diff -u -p -r1.82 vmstat.c
> --- vmstat.c  18 Dec 2016 23:36:32 -0000      1.82
> +++ vmstat.c  3 May 2018 06:19:35 -0000
> @@ -180,6 +180,8 @@ initvmstat(void)
> 
>       intrloc = calloc(nintr, sizeof(long));
>       intrname = calloc(nintr, sizeof(char *));
> +     if (intrloc == NULL || intrname == NULL)
> +             errx(2, "out of memory");

errno is set, so use err(1, NULL).

        -Otto

> 
>       for (i = 0; i < nintr; i++) {
>               char name[128];
> 
> -- 
> Best Regards
> Nan Xiao(肖楠)

Reply via email to