Index | Thread | Search

From:
Nihal Jere <nihal@nihaljere.xyz>
Subject:
aucat: check for failed allocation
To:
tech@openbsd.org
Date:
Sun, 7 Jul 2024 19:38:33 -0500

Download raw body.

Thread
  • Nihal Jere:

    aucat: check for failed allocation

diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c
index a9b59863d63..7c67cb05d46 100644
--- a/usr.bin/aucat/aucat.c
+++ b/usr.bin/aucat/aucat.c
@@ -153,7 +153,11 @@ allocbuf(int nfr, int nch, int bps)
 		panic();
 	}
 	fsize = nch * bps;
-	return reallocarray(NULL, nfr, fsize);
+
+	void *ptr = reallocarray(NULL, nfr, fsize);
+	if (!ptr)
+		err(1, "reallocarray");
+	return ptr;
 }
 
 static void