aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQball Cow <qball@qballcow.nl>2007-12-31 18:41:08 +0000
committerQball Cow <qball@qballcow.nl>2007-12-31 18:41:08 +0000
commitc75d33752af940e9b0868e31cce064faebef5fe5 (patch)
treebd8e8d84da009c6922ed82f6923ddeb0db5eedd7 /src
parenta4ed0a83584ca2ad8eb29927da17bc32d36b7272 (diff)
downloadmpd-c75d33752af940e9b0868e31cce064faebef5fe5.tar.gz
mpd-c75d33752af940e9b0868e31cce064faebef5fe5.tar.xz
mpd-c75d33752af940e9b0868e31cce064faebef5fe5.zip
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
Diffstat (limited to 'src')
-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;