diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-09-26 07:16:24 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-09-26 07:16:24 +0000 |
commit | 3ea20cc260f702a5275210fe31883b72721f9888 (patch) | |
tree | 2bef5e1388596b19525901f50e34ac95c17b9503 /usr.sbin | |
parent | 0d6324ebdfb30c16e3cdf15f4de2dd7838167311 (diff) |
if malloc fails, say how much we tried to alloc
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/kvm_mkdb/nlist.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/kvm_mkdb/nlist.c b/usr.sbin/kvm_mkdb/nlist.c index 6fe58067d12..2c96b999938 100644 --- a/usr.sbin/kvm_mkdb/nlist.c +++ b/usr.sbin/kvm_mkdb/nlist.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nlist.c,v 1.13 1998/08/23 00:57:15 millert Exp $ */ +/* $OpenBSD: nlist.c,v 1.14 1998/09/26 07:16:23 millert Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "from: @(#)nlist.c 8.1 (Berkeley) 6/6/93"; #else -static char *rcsid = "$OpenBSD: nlist.c,v 1.13 1998/08/23 00:57:15 millert Exp $"; +static char *rcsid = "$OpenBSD: nlist.c,v 1.14 1998/09/26 07:16:23 millert Exp $"; #endif #endif /* not lint */ @@ -128,7 +128,7 @@ __aout_knlist(fd, db) /* Read in the string table. */ strsize -= sizeof(strsize); if (!(strtab = malloc(strsize))) - errx(1, "cannot allocate memory"); + errx(1, "cannot allocate %d bytes", strsize); if ((nr = read(fd, strtab, strsize)) != strsize) badread(nr, "corrupted symbol table"); @@ -311,7 +311,8 @@ __elf_knlist(fd, db) sh = (Elf32_Shdr *)malloc(sizeof(Elf32_Shdr) * eh.e_shnum); if (sh == NULL) - errx(1, "cannot allocate memory"); + errx(1, "cannot allocate %d bytes", + sizeof(Elf32_Shdr) * eh.e_shnum); if (fseek (fp, eh.e_shoff, SEEK_SET) < 0) badfmt("no exec header"); @@ -321,7 +322,7 @@ __elf_knlist(fd, db) shstr = (char *)malloc(sh[eh.e_shstrndx].sh_size); if (shstr == NULL) - errx(1, "cannot allocate memory"); + errx(1, "cannot allocate %d bytes", sh[eh.e_shstrndx].sh_size); if (fseek (fp, sh[eh.e_shstrndx].sh_offset, SEEK_SET) < 0) badfmt("corrupt file"); if (fread(shstr, sh[eh.e_shstrndx].sh_size, 1, fp) != 1) |