aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)