X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=lib%2Fxmalloc.c;h=e86fb0707c687a64c4781f9f665bbee7e97a4eac;hp=037fab87e2d6d9e4e1ab68e1cb89e9f9874c4889;hb=9e9e1925b901dff87518f0e1534a33e48eab8303;hpb=da9a1e8084a9b73306bdbc541ee8af938c3e7754 diff --git a/lib/xmalloc.c b/lib/xmalloc.c index 037fab87..e86fb070 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(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. */