diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-02-06 18:54:41 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-31 17:05:53 +0300 |
commit | a6d2fd0215c4f4507281aaf37f456771841ee6b1 (patch) | |
tree | 059707346b9b8bca4e59bd0c4d6d8feaba54d8c5 | |
parent | 7fb393f9ba3866026c8fb2c5c5ef7e0906cfe8b4 (diff) |
Stamp info: Use dedicated function to free up memory
This way it's more flexible to extend StampData structure
with additional stuff which might require memory free.
-rw-r--r-- | source/blender/blenkernel/BKE_image.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 8 | ||||
-rw-r--r-- | source/blender/render/intern/source/render_result.c | 4 |
3 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 3c716f39dd0..01f5d332c30 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -70,6 +70,7 @@ void BKE_render_result_stamp_info(struct Scene *scene, struct Object *camera, void BKE_imbuf_stamp_info(struct RenderResult *rr, struct ImBuf *ibuf); void BKE_stamp_info_from_imbuf(struct RenderResult *rr, struct ImBuf *ibuf); void BKE_stamp_info_callback(void *data, struct StampData *stamp_data, StampCallback callback, bool noskip); +void BKE_stamp_data_free(struct StampData *stamp_data); void BKE_image_stamp_buf( struct Scene *scene, struct Object *camera, const struct StampData *stamp_data_template, unsigned char *rect, float *rectf, int width, int height, int channels); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 54f0923cabc..7706bf921f4 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -2124,6 +2124,14 @@ void BKE_stamp_info_callback(void *data, struct StampData *stamp_data, StampCall #undef CALL } +void BKE_stamp_data_free(struct StampData *stamp_data) +{ + if (stamp_data == NULL) { + return; + } + MEM_freeN(stamp_data); +} + /* wrap for callback only */ static void metadata_change_field(void *data, const char *propname, char *propvalue, int UNUSED(len)) { diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index 8e6e6c9bb7d..df51cd3c2e6 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -116,8 +116,8 @@ void render_result_free(RenderResult *res) MEM_freeN(res->text); if (res->error) MEM_freeN(res->error); - if (res->stamp_data) - MEM_freeN(res->stamp_data); + + BKE_stamp_data_free(res->stamp_data); MEM_freeN(res); } |