summaryrefslogtreecommitdiff
path: root/lib/strdup.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2006-07-17 15:25:37 +0000
committerYang Tse <yangsita@gmail.com>2006-07-17 15:25:37 +0000
commitf72c4e82fd4155eb108d61a17d314d391e4f7730 (patch)
tree7f260f1c71095539da8f3985d2242a95ce2561a2 /lib/strdup.c
parent9c83a20a278e69170f24abff36623471ec53071d (diff)
downloadgnurl-f72c4e82fd4155eb108d61a17d314d391e4f7730.tar.gz
gnurl-f72c4e82fd4155eb108d61a17d314d391e4f7730.tar.bz2
gnurl-f72c4e82fd4155eb108d61a17d314d391e4f7730.zip
Return NULL if argument is NULL.
Diffstat (limited to 'lib/strdup.c')
-rw-r--r--lib/strdup.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/strdup.c b/lib/strdup.c
index a9ed448a8..e16e08a72 100644
--- a/lib/strdup.c
+++ b/lib/strdup.c
@@ -30,6 +30,9 @@ char *curlx_strdup(const char *str)
int len;
char *newstr;
+ if (!str)
+ return (char *)NULL;
+
len = strlen(str);
newstr = (char *) malloc((len+1)*sizeof(char));
if (!newstr)