sw_engine stroke: fix memory leak.

Properly free data after use.

@Issues: 178
This commit is contained in:
Hermet Park 2020-12-10 11:48:08 +09:00
parent dbbecef101
commit 393be38f2a

View file

@ -324,7 +324,7 @@ SwOutline* _genDashOutline(const Shape* sdata, const Matrix* transform)
dash.cnt = sdata->strokeDash(&pattern); dash.cnt = sdata->strokeDash(&pattern);
if (dash.cnt == 0) return nullptr; if (dash.cnt == 0) return nullptr;
//Is it safe to mutual exclusive? //OPTMIZE ME: Use mempool???
dash.pattern = const_cast<float*>(pattern); dash.pattern = const_cast<float*>(pattern);
dash.outline = static_cast<SwOutline*>(calloc(1, sizeof(SwOutline))); dash.outline = static_cast<SwOutline*>(calloc(1, sizeof(SwOutline)));
dash.outline->opened = true; dash.outline->opened = true;
@ -634,6 +634,7 @@ fail:
if (shapeOutline->cntrs) free(shapeOutline->cntrs); if (shapeOutline->cntrs) free(shapeOutline->cntrs);
if (shapeOutline->pts) free(shapeOutline->pts); if (shapeOutline->pts) free(shapeOutline->pts);
if (shapeOutline->types) free(shapeOutline->types); if (shapeOutline->types) free(shapeOutline->types);
free(shapeOutline);
} }
mpoolRetStrokeOutline(tid); mpoolRetStrokeOutline(tid);