summaryrefslogtreecommitdiff
path: root/xtalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'xtalloc.c')
-rw-r--r--xtalloc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/xtalloc.c b/xtalloc.c
index 849e12d349..d9893ae889 100644
--- a/xtalloc.c
+++ b/xtalloc.c
@@ -50,3 +50,17 @@ xtalloc_strdup (const void *t, const char *p)
return ret;
}
+
+char *
+xtalloc_strndup (const void *t, const char *p, size_t n)
+{
+ char *ret;
+
+ ret = talloc_strndup (t, p, n);
+ if (ret == NULL) {
+ fprintf (stderr, "Out of memory.\n");
+ exit (1);
+ }
+
+ return ret;
+}