X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=lib%2Fxmalloc.c;fp=lib%2Fxmalloc.c;h=e1ab3140b79e08c5b2c0077deb564afe041b2c2d;hp=037fab87e2d6d9e4e1ab68e1cb89e9f9874c4889;hb=462ab530e546f5732dfd51134751da6f6910d679;hpb=e64ef59df44d39c76c00dee22841bbcce7c24e47 diff --git a/lib/xmalloc.c b/lib/xmalloc.c index 037fab87..e1ab3140 100644 --- a/lib/xmalloc.c +++ b/lib/xmalloc.c @@ -21,6 +21,7 @@ #include #include +#include #if STDC_HEADERS # include @@ -124,6 +125,18 @@ xrealloc (p, n) return p; } +/* Duplicate a string */ + +char *xstrdup(const char *s) +{ + char *p; + + p = strdup(s); + if(!p) + xalloc_fail ((int)strlen(s)); + return p; +} + #ifdef NOT_USED /* Allocate memory for N elements of S bytes, with error checking. */