summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2023-12-18 13:23:53 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2023-12-18 13:23:53 +0000
commitfbc23b03295caef7336c9ef8dee13dcff4f25afb (patch)
treeb7777813bd98a975246c0329f115db21b5204992
parent740bceefe4a6b5d996ee6f7a399fe78a2e764638 (diff)
Check if calloc calls succeeded; ok millert@
-rw-r--r--sbin/dump/main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/dump/main.c b/sbin/dump/main.c
index 75133ff42ca..b23c408cd96 100644
--- a/sbin/dump/main.c
+++ b/sbin/dump/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.63 2022/06/02 15:35:55 millert Exp $ */
+/* $OpenBSD: main.c,v 1.64 2023/12/18 13:23:52 otto Exp $ */
/* $NetBSD: main.c,v 1.14 1997/06/05 11:13:24 lukem Exp $ */
/*-
@@ -465,6 +465,9 @@ main(int argc, char *argv[])
usedinomap = calloc((unsigned) mapsize, sizeof(char));
dumpdirmap = calloc((unsigned) mapsize, sizeof(char));
dumpinomap = calloc((unsigned) mapsize, sizeof(char));
+ if (usedinomap == NULL || dumpdirmap == NULL || dumpinomap == NULL)
+ quit("Failed to allocate tables");
+
tapesize = 3 * (howmany(mapsize * sizeof(char), TP_BSIZE) + 1);
nonodump = spcl.c_level < honorlevel;