From f72c4e82fd4155eb108d61a17d314d391e4f7730 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Mon, 17 Jul 2006 15:25:37 +0000 Subject: Return NULL if argument is NULL. --- lib/strdup.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') 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) -- cgit v1.2.3