diff --git a/lib/xfuncs.c b/lib/xfuncs.c index aaf0788..1dc2ea9 100644 --- a/lib/xfuncs.c +++ b/lib/xfuncs.c @@ -56,10 +56,15 @@ char *xstrdup(const char *s) { - char *p = strdup(s); + char *p; + if (!s) + return NULL; + + p = strdup(s); if (!p) panic("ERROR: out of memory\n"); + return p; } EXPORT_SYMBOL(xstrdup);