Fix xstrdup if str is NULL.

If str is NULL we return an uninitialized char *
This commit is contained in:
Philippe Pepiot 2012-01-19 11:18:46 +01:00
parent d983e65ff4
commit 3e684a5916

View File

@ -74,7 +74,7 @@ xasprintf(char **strp, const char *fmt, ...)
char *
xstrdup(const char *str)
{
char *ret;
char *ret = NULL;
if(str == NULL || (ret = strdup(str)) == NULL)
warnx("strdup(%s)", str);