summaryrefslogtreecommitdiffstats
path: root/release/sysinstall/misc.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-05-08 21:39:40 +0000
committerjkh <jkh@FreeBSD.org>1995-05-08 21:39:40 +0000
commit1aa6f0255a93cada013e339b339895f4d6c1b066 (patch)
treebbc7db4913e184339a9fef242727b484f56afaa6 /release/sysinstall/misc.c
parentdb10ed51dd5e2127eff1c14b27784304cce58d3e (diff)
downloadFreeBSD-src-1aa6f0255a93cada013e339b339895f4d6c1b066.zip
FreeBSD-src-1aa6f0255a93cada013e339b339895f4d6c1b066.tar.gz
Sync these up so that they'll get into my CVS tree at home, where I'll continue
working on the distribution extract stuff.
Diffstat (limited to 'release/sysinstall/misc.c')
-rw-r--r--release/sysinstall/misc.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/release/sysinstall/misc.c b/release/sysinstall/misc.c
index 794c498..500b454 100644
--- a/release/sysinstall/misc.c
+++ b/release/sysinstall/misc.c
@@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
- * $Id: misc.c,v 1.2 1995/04/29 19:33:04 jkh Exp $
+ * $Id: misc.c,v 1.3 1995/05/01 21:56:27 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -104,12 +104,28 @@ safe_malloc(size_t size)
{
void *ptr;
+ if (size <= 0)
+ msgFatal("Invalid malloc size of %d!", size);
ptr = malloc(size);
if (!ptr)
msgFatal("Out of memory!");
return ptr;
}
+/* A realloc that checks errors */
+void *
+safe_realloc(void *orig, size_t size)
+{
+ void *ptr;
+
+ if (size <= 0)
+ msgFatal("Invalid realloc size of %d!", size);
+ ptr = realloc(orig, size);
+ if (!ptr)
+ msgFatal("Out of memory!");
+ return ptr;
+}
+
/*
* These next routines are kind of specialized just for building string lists
* for dialog_menu().
OpenPOWER on IntegriCloud