summaryrefslogtreecommitdiff
path: root/usr.sbin/sade/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/sade/misc.c')
-rw-r--r--usr.sbin/sade/misc.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.sbin/sade/misc.c b/usr.sbin/sade/misc.c
index 4f789e2bea3a..794c49888fb6 100644
--- a/usr.sbin/sade/misc.c
+++ b/usr.sbin/sade/misc.c
@@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
- * $Id: misc.c,v 1.1.1.1 1995/04/27 12:50:35 jkh Exp $
+ * $Id: misc.c,v 1.2 1995/04/29 19:33:04 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -98,6 +98,18 @@ safe_free(void *ptr)
free(ptr);
}
+/* A malloc that checks errors */
+void *
+safe_malloc(size_t size)
+{
+ void *ptr;
+
+ ptr = malloc(size);
+ if (!ptr)
+ msgFatal("Out of memory!");
+ return ptr;
+}
+
/*
* These next routines are kind of specialized just for building string lists
* for dialog_menu().