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
This commit is contained in:
Qball Cow 2007-12-31 18:41:08 +00:00
parent a4ed0a8358
commit c75d33752a

View File

@ -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;