summaryrefslogtreecommitdiff
path: root/lib/xmalloc.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-06-10 23:45:08 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2009-06-10 23:45:08 +0200
commit3d15dcdb1cc91c694aa9319b86bb37510d7ed12b (patch)
tree96c5dda68741dd75b4b5d0037e782d5d89726d93 /lib/xmalloc.c
parentb99d378698641b9821e4b708a90761aeb9bf6cc4 (diff)
Changes OSPF to generate stub networks for non-primary addresses.
Also does some reorganization in RT LSA announcement.
Diffstat (limited to 'lib/xmalloc.c')
-rw-r--r--lib/xmalloc.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/xmalloc.c b/lib/xmalloc.c
index bc386c83..da2f0941 100644
--- a/lib/xmalloc.c
+++ b/lib/xmalloc.c
@@ -32,4 +32,24 @@ xmalloc(unsigned size)
die("Unable to allocate %d bytes of memory", size);
}
+/**
+ * xrealloc - realloc with checking
+ * @ptr: original memory block
+ * @size: block size
+ *
+ * This function is equivalent to realloc() except that in case of
+ * failure it calls die() to quit the program instead of returning
+ * a %NULL pointer.
+ *
+ * Wherever possible, please use the memory resources instead.
+ */
+void *
+xrealloc(void *ptr, unsigned size)
+{
+ void *p = realloc(ptr, size);
+ if (p)
+ return p;
+ die("Unable to allocate %d bytes of memory", size);
+}
+
#endif