aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/utils.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c
index e9865aa24..bfe3de200 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -121,7 +121,11 @@ unsigned long readLEuint32(const unsigned char *p)
mpd_malloc char *xstrdup(const char *s)
{
- char *ret = strdup(s);
+ char *ret;
+ /* Return NULL, if s is NULL */
+ if(!s)
+ return NULL;
+ ret = strdup(s);
if (mpd_unlikely(!ret))
FATAL("OOM: strdup\n");
return ret;