From: ratchov Date: Mon, 8 Jul 2024 16:10:34 +0000 (+0000) Subject: aucat: check for failled allocation X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5660a5f0332b069134d1ea6e866f076247b3ea96;p=openbsd aucat: check for failled allocation From Nihal Jere , thanks! --- diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c index a9b59863d63..3c5013845cf 100644 --- a/usr.bin/aucat/aucat.c +++ b/usr.bin/aucat/aucat.c @@ -147,13 +147,18 @@ static void * allocbuf(int nfr, int nch, int bps) { size_t fsize; + void *ptr; if (nch < 0 || nch > NCHAN_MAX || bps < 0 || bps > 4) { log_puts("allocbuf: bogus channels or bytes per sample count\n"); panic(); } fsize = nch * bps; - return reallocarray(NULL, nfr, fsize); + + ptr = reallocarray(NULL, nfr, fsize); + if (ptr == NULL) + err(1, "reallocarray"); + return ptr; } static void