From: Pierre Habouzit Date: Mon, 30 Oct 2006 16:48:38 +0000 (+0100) Subject: make m_dupstr return NULL if the string was empty. X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=b07d69b15852a06183f7b2298436e18150c36958;hp=d9960a434f5c00a534a0dabe02ae5ab8d4881569 make m_dupstr return NULL if the string was empty. --- diff --git a/lib-lib/str.h b/lib-lib/str.h index 4ef9d48..8850830 100644 --- a/lib-lib/str.h +++ b/lib-lib/str.h @@ -37,7 +37,8 @@ static inline ssize_t m_strnlen(const char *s, ssize_t n) { } static inline char *m_strdup(const char *s) { - return p_dupstr(s, m_strlen(s)); + ssize_t len = m_strlen(s); + return len ? p_dup(s, len + 1) : NULL; } static inline int m_strcmp(const char *a, const char *b) {