-const char miscutil_rcs[] = "$Id: miscutil.c,v 1.79 2015/08/12 10:34:38 fabiankeil Exp $";
+const char miscutil_rcs[] = "$Id: miscutil.c,v 1.80 2016/01/16 12:33:36 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/miscutil.c,v $
 }
 
 
+/*********************************************************************
+ *
+ * Function    :  zalloc_or_die
+ *
+ * Description :  zalloc wrapper that either succeeds or causes
+ *                program termination.
+ *
+ *                Useful in situations were the string length is
+ *                "small" and zalloc() failures couldn't be handled
+ *                better anyway. In case of debug builds, failures
+ *                trigger an assert().
+ *
+ * Parameters  :
+ *          1  :  size = Size of memory chunk to return.
+ *
+ * Returns     :  Pointer to newly malloc'd memory chunk.
+ *
+ *********************************************************************/
+void *zalloc_or_die(size_t size)
+{
+   void *buffer;
+
+   buffer = zalloc(size);
+   if (buffer == NULL)
+   {
+      assert(buffer != NULL);
+      log_error(LOG_LEVEL_FATAL, "Out of memory in zalloc_or_die().");
+      exit(1);
+   }
+
+   return(buffer);
+
+}
+
 /*********************************************************************
  *
  * Function    :  strdup_or_die
 
 #ifndef MISCUTIL_H_INCLUDED
 #define MISCUTIL_H_INCLUDED
-#define MISCUTIL_H_VERSION "$Id: miscutil.h,v 1.36 2012/07/23 12:41:59 fabiankeil Exp $"
+#define MISCUTIL_H_VERSION "$Id: miscutil.h,v 1.37 2012/11/24 13:58:17 fabiankeil Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/miscutil.h,v $
 
 extern const char *basedir;
 extern void *zalloc(size_t size);
+extern void *zalloc_or_die(size_t size);
 extern char *strdup_or_die(const char *str);
 extern void *malloc_or_die(size_t buffer_size);