From 4c3cffeb642f10eba30d5256ad9f295596596b70 Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Tue, 9 Aug 2005 09:49:01 +0000 Subject: [PATCH] Check that malloc() succeeds in makelist. Submitted by: Roman Divacky (who did a very complete review of both make_index.c and phttpget.c) --- usr.sbin/portsnap/make_index/make_index.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.sbin/portsnap/make_index/make_index.c b/usr.sbin/portsnap/make_index/make_index.c index 6139fad0a6cc..fbb8dd916864 100644 --- a/usr.sbin/portsnap/make_index/make_index.c +++ b/usr.sbin/portsnap/make_index/make_index.c @@ -116,6 +116,8 @@ makelist(char * str, size_t * n) /* Allocate and fill an array */ d = malloc(*n * sizeof(DEP)); + if (d == NULL) + err(1, "malloc(DEP)"); for (i = 0; i < *n; i++) { d[i].name = strdup2(strsep(&str, " "));