From 603c87cd8ff67eb5ceabdb21520c90d6b4bb872d Mon Sep 17 00:00:00 2001 From: Palana Date: Wed, 25 Jun 2014 23:15:55 +0200 Subject: [PATCH] Fix b(w)strdup_n returning NULL for empty strings --- libobs/util/bmem.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libobs/util/bmem.h b/libobs/util/bmem.h index 6afd8566b..b96c8046b 100644 --- a/libobs/util/bmem.h +++ b/libobs/util/bmem.h @@ -54,7 +54,7 @@ static inline void *bzalloc(size_t size) static inline char *bstrdup_n(const char *str, size_t n) { char *dup; - if (!str || !*str) + if (!str) return NULL; dup = (char*)bmemdup(str, n+1); @@ -66,7 +66,7 @@ static inline char *bstrdup_n(const char *str, size_t n) static inline wchar_t *bwstrdup_n(const wchar_t *str, size_t n) { wchar_t *dup; - if (!str || (!*str && n > 0)) + if (!str) return NULL; dup = (wchar_t*)bmemdup(str, (n+1) * sizeof(wchar_t));