USD: Release ImBuf objects during export #107361

Merged
Jesse Yurkovich merged 1 commits from deadpin/blender:fix-usd-export-leak into main 2023-04-27 22:35:33 +02:00
1 changed files with 3 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "BLI_linklist.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_memory_utils.hh"
#include "BLI_path_util.h"
#include "BLI_string.h"
@ -378,6 +379,7 @@ static std::string get_in_memory_texture_filename(Image *ima)
ImageFormatData imageFormat;
BKE_image_format_from_imbuf(&imageFormat, imbuf);
BKE_image_release_ibuf(ima, imbuf, nullptr);
char file_name[FILE_MAX];
/* Use the image name for the file name. */
@ -405,6 +407,7 @@ static void export_in_memory_texture(Image *ima,
}
ImBuf *imbuf = BKE_image_acquire_ibuf(ima, nullptr, nullptr);
BLI_SCOPED_DEFER([&]() { BKE_image_release_ibuf(ima, imbuf, nullptr); });
if (!imbuf) {
return;
}