diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-12-10 08:46:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-12-10 08:56:09 +0300 |
commit | d97845a693c28b8d56934c1b34bdb5c346a2603b (patch) | |
tree | 060218dd925146f035b2042ba3ae3b59fa583072 /source/blender/blenlib/intern/string.c | |
parent | 3ec7cf64bcf8b8bfa098529c784d73c41f46a348 (diff) |
BLI_string: return NULL from BLI_str_quoted_substrN on failure
This was returning an empty allocated string, however almost
all callers checked if the return value was NULL before freeing,
making for misunderstandings on the intended use of this function.
BCAnimationSampler::initialize_curves for example detected the
f-curves animation type to 'bone' based on a non-NULL return value
which never failed.
Also fixes two leaks where the the result of BLI_str_quoted_substrN
wasn't freed.
Diffstat (limited to 'source/blender/blenlib/intern/string.c')
-rw-r--r-- | source/blender/blenlib/intern/string.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index dccc700c761..b0d87838d06 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -445,7 +445,7 @@ char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict return result; } } - return BLI_strdupn("", 0); + return NULL; } /** |