Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-12-10 08:46:04 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-12-10 08:56:09 +0300
commitd97845a693c28b8d56934c1b34bdb5c346a2603b (patch)
tree060218dd925146f035b2042ba3ae3b59fa583072 /source/blender/editors/animation/anim_filter.c
parent3ec7cf64bcf8b8bfa098529c784d73c41f46a348 (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_filter.c')
-rw-r--r--source/blender/editors/animation/anim_filter.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 2e65fff69f1..f4a487140ff 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1063,13 +1063,12 @@ static bool skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_id
/* only consider if F-Curve involves pose.bones */
if ((fcu->rna_path) && strstr(fcu->rna_path, "pose.bones")) {
- bPoseChannel *pchan;
- char *bone_name;
/* get bone-name, and check if this bone is selected */
- bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
- pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
+ bPoseChannel *pchan = NULL;
+ char *bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
if (bone_name) {
+ pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
MEM_freeN(bone_name);
}
@@ -1106,13 +1105,12 @@ static bool skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_id
if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
Editing *ed = BKE_sequencer_editing_get(scene, false);
Sequence *seq = NULL;
- char *seq_name;
if (ed) {
/* get strip name, and check if this strip is selected */
- seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
- seq = BKE_sequence_get_by_name(ed->seqbasep, seq_name, false);
+ char *seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
if (seq_name) {
+ seq = BKE_sequence_get_by_name(ed->seqbasep, seq_name, false);
MEM_freeN(seq_name);
}
}
@@ -1130,13 +1128,12 @@ static bool skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_id
/* check for selected nodes */
if ((fcu->rna_path) && strstr(fcu->rna_path, "nodes")) {
- bNode *node;
- char *node_name;
+ bNode *node = NULL;
/* get strip name, and check if this strip is selected */
- node_name = BLI_str_quoted_substrN(fcu->rna_path, "nodes[");
- node = nodeFindNodebyName(ntree, node_name);
+ char *node_name = BLI_str_quoted_substrN(fcu->rna_path, "nodes[");
if (node_name) {
+ node = nodeFindNodebyName(ntree, node_name);
MEM_freeN(node_name);
}