summaryrefslogtreecommitdiff
path: root/distrib
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2007-08-07 05:42:06 +0000
committerRay Lai <ray@cvs.openbsd.org>2007-08-07 05:42:06 +0000
commit2399ac679062ba20642d46e01705123dcd4b412c (patch)
treeb64c1b4c5ebdee268e00be39bfcbd9bca6dbc227 /distrib
parente9a829aea6a0bf6b9da2c5f72407bf80c083b71f (diff)
Check for calloc failure and replace an assert with errx.
OK millert and otto.
Diffstat (limited to 'distrib')
-rw-r--r--distrib/crunch/crunchide/elf_hide.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/distrib/crunch/crunchide/elf_hide.c b/distrib/crunch/crunchide/elf_hide.c
index cd0285f2413..65918e618af 100644
--- a/distrib/crunch/crunchide/elf_hide.c
+++ b/distrib/crunch/crunchide/elf_hide.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: elf_hide.c,v 1.10 2006/03/23 02:49:59 deraadt Exp $ */
+/* $OpenBSD: elf_hide.c,v 1.11 2007/08/07 05:42:05 ray Exp $ */
/*
* Copyright (c) 1997 Dale Rahn.
@@ -29,12 +29,13 @@
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#include <err.h>
+#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
#include <sys/exec.h>
#ifdef _NLIST_DO_ELF
#include <sys/exec_elf.h>
@@ -383,8 +384,8 @@ reorder_syms(Elf_Ehdr * ehdr, Elf_Shdr * symsect,
tmpsymtab = (Elf_Sym *) calloc(1, symtabsize);
symmap = (Symmap *) calloc(nsyms, sizeof(Symmap));
-
- assert(NULL != tmpsymtab);
+ if (!tmpsymtab || !symmap)
+ errx(5, "calloc: %s", strerror(ENOMEM));
bcopy(symtab, tmpsymtab, symtabsize);