Fix: Hydra memory leak when generated images are saved
When attempting to cache a generated image, the ImageFormatData's view_settings would inadvertently be leaked due to the settings being assigned a different set of values without first being free'd. Additionally, there was another missed free from an early return a bit later in the same function. Pull Request: https://projects.blender.org/blender/blender/pulls/128229
This commit is contained in:
committed by
Jesse Yurkovich
parent
04c5044e61
commit
6c62fe7ac8
@@ -35,13 +35,15 @@ static std::string cache_image_file(
|
||||
const char *r_ext = BLI_path_extension_or_end(image->id.name);
|
||||
if (!pxr::HioImageRegistry::GetInstance().IsSupportedImageFile(image->id.name)) {
|
||||
BKE_image_path_ext_from_imformat(&scene->r.im_format, &r_ext);
|
||||
opts.im_format = scene->r.im_format;
|
||||
BKE_image_format_free(&opts.im_format);
|
||||
BKE_image_format_copy(&opts.im_format, &scene->r.im_format);
|
||||
}
|
||||
|
||||
SNPRINTF(file_name, "img_%p%s", image, r_ext);
|
||||
|
||||
file_path = blender::io::usd::get_image_cache_file(file_name);
|
||||
if (check_exist && BLI_exists(file_path.c_str())) {
|
||||
BKE_image_save_options_free(&opts);
|
||||
return file_path;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user