summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/xfuncs.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/xfuncs.c b/lib/xfuncs.c
index aaf0788544..1dc2ea92d8 100644
--- a/lib/xfuncs.c
+++ b/lib/xfuncs.c
@@ -56,10 +56,15 @@ EXPORT_SYMBOL(xzalloc);
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);