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/editors/animation/anim_ipo_utils.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/editors/animation/anim_ipo_utils.c')
-rw-r--r-- | source/blender/editors/animation/anim_ipo_utils.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c index 72103d68b05..5992545bdbe 100644 --- a/source/blender/editors/animation/anim_ipo_utils.c +++ b/source/blender/editors/animation/anim_ipo_utils.c @@ -112,7 +112,8 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu) char *constName = BLI_str_quoted_substrN(fcu->rna_path, "constraints["); /* assemble the string to display in the UI... */ - structname = BLI_sprintfN("%s : %s", pchanName, constName); + structname = BLI_sprintfN( + "%s : %s", pchanName ? pchanName : "", constName ? constName : ""); free_structname = 1; /* free the temp names */ |