1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-21 23:18:00 -08:00

aucat: check for failled allocation

From Nihal Jere <nihal@nihaljere.xyz>, thanks!
This commit is contained in:
ratchov 2024-07-08 16:10:34 +00:00
parent e163d0c441
commit 5660a5f033

View File

@ -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