diff --git a/src/vkvg_context.c b/src/vkvg_context.c index ea5b1f5d..a7738b97 100644 --- a/src/vkvg_context.c +++ b/src/vkvg_context.c @@ -234,8 +234,6 @@ void _clear_context (VkvgContext ctx) { vkvg_context_save_t* cur = next; next = cur->pNext; _free_ctx_save (cur); - if (cur->pattern) - vkvg_pattern_destroy (cur->pattern); } //free additional stencil use in save/restore process if (ctx->savedStencils) { diff --git a/src/vkvg_context_internal.c b/src/vkvg_context_internal.c index 42ad96de..53421175 100644 --- a/src/vkvg_context_internal.c +++ b/src/vkvg_context_internal.c @@ -1311,6 +1311,8 @@ bool ptInTriangle(vec2 p, vec2 p0, vec2 p1, vec2 p2) { void _free_ctx_save (vkvg_context_save_t* sav){ if (sav->dashCount > 0) free (sav->dashes); + if (sav->pattern) + vkvg_pattern_destroy(sav->pattern); free (sav); }