Commit c75d3375 authored by Qball Cow's avatar Qball Cow

Don't let xstrdup(s) crash crash when s is NULL, but return Null in stead

git-svn-id: https://svn.musicpd.org/mpd/trunk@7111 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent a4ed0a83
...@@ -121,7 +121,11 @@ unsigned long readLEuint32(const unsigned char *p) ...@@ -121,7 +121,11 @@ unsigned long readLEuint32(const unsigned char *p)
mpd_malloc char *xstrdup(const char *s) 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)) if (mpd_unlikely(!ret))
FATAL("OOM: strdup\n"); FATAL("OOM: strdup\n");
return ret; return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment