Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-01-10 19:08:31 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-01-10 19:09:48 +0300
commitb207f4e4a2c520f65d2e936430ce67d418b86f46 (patch)
treea16a91586c3ba423685bde86755af05912d1108c /source/blender/blenkernel/intern/subdiv_foreach.c
parente551ddf712e5e8c8fb4bfcd99158158ac2f7d56e (diff)
Subdiv: Fix memory leak
Was visible when mesh had n-gons.
Diffstat (limited to 'source/blender/blenkernel/intern/subdiv_foreach.c')
-rw-r--r--source/blender/blenkernel/intern/subdiv_foreach.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/subdiv_foreach.c b/source/blender/blenkernel/intern/subdiv_foreach.c
index 2cfcc137ba5..5c843561a4d 100644
--- a/source/blender/blenkernel/intern/subdiv_foreach.c
+++ b/source/blender/blenkernel/intern/subdiv_foreach.c
@@ -148,11 +148,15 @@ static void *subdiv_foreach_tls_alloc(SubdivForeachTaskContext *ctx)
return tls;
}
-static void subdiv_foreach_tls_free(void *tls)
+static void subdiv_foreach_tls_free(SubdivForeachTaskContext *ctx, void *tls)
{
- if (tls != NULL) {
- MEM_freeN(tls);
+ if (tls == NULL) {
+ return;
+ }
+ if (ctx->foreach_context != NULL) {
+ ctx->foreach_context->user_data_tls_free(tls);
}
+ MEM_freeN(tls);
}
/* =============================================================================
@@ -1972,7 +1976,7 @@ static void subdiv_foreach_single_thread_tasks(SubdivForeachTaskContext *ctx)
subdiv_foreach_every_edge_vertices(ctx, tls);
/* Run callbacks which are supposed to be run once per shared geometry. */
subdiv_foreach_single_geometry_vertices(ctx, tls);
- subdiv_foreach_tls_free(tls);
+ subdiv_foreach_tls_free(ctx, tls);
}
static void subdiv_foreach_task(