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.
This commit is contained in:
@@ -448,6 +448,7 @@ void BCAnimationSampler::initialize_curves(BCAnimationCurveMap &curves, Object *
|
||||
char *boneName = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
|
||||
if (boneName) {
|
||||
object_type = BC_ANIMATION_TYPE_BONE;
|
||||
MEM_freeN(boneName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user