Fix #142195: Crash when adding stereo 3D image

Caused by assigning pointer to address which is eventually freed.

Use `MEM_mallocN()` with copy assignment instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/142361
This commit is contained in:
Richard Antalik
2025-07-21 14:05:31 +02:00
committed by Sergey Sharybin
parent 2933433abc
commit 40b2cd92ee

View File

@@ -252,7 +252,8 @@ Strip *add_image_strip(Main *bmain, Scene *scene, ListBase *seqbase, LoadData *l
strip->views_format = load_data->views_format;
}
if (load_data->stereo3d_format) {
strip->stereo3d_format = load_data->stereo3d_format;
strip->stereo3d_format = MEM_mallocN<Stereo3dFormat>("strip stereo3d format");
*strip->stereo3d_format = *load_data->stereo3d_format;
}
/* Set initial scale based on load_data->fit_method. */
@@ -473,7 +474,8 @@ Strip *add_movie_strip(Main *bmain, Scene *scene, ListBase *seqbase, LoadData *l
strip->views_format = load_data->views_format;
}
if (load_data->stereo3d_format) {
strip->stereo3d_format = load_data->stereo3d_format;
strip->stereo3d_format = MEM_mallocN<Stereo3dFormat>("strip stereo3d format");
*strip->stereo3d_format = *load_data->stereo3d_format;
}
for (i = 0; i < totfiles; i++) {