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:
parent
a4ed0a8358
commit
c75d33752a
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user