summaryrefslogtreecommitdiff
path: root/examples/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/common.c')
-rw-r--r--examples/common.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/common.c b/examples/common.c
index 96f5eaa8e..118072044 100644
--- a/examples/common.c
+++ b/examples/common.c
@@ -235,3 +235,13 @@ void treeish_to_tree(
git_object_free(obj);
}
+void *xrealloc(void *oldp, size_t newsz)
+{
+ void *p = realloc(oldp, newsz);
+ if (p == NULL) {
+ fprintf(stderr, "Cannot allocate memory, exiting.\n");
+ exit(1);
+ }
+ return p;
+}
+