sw_engine: fix memory leak. submit/tizen/20200830.214225
authorHermet Park <chuneon.park@samsung.com>
Fri, 28 Aug 2020 10:16:01 +0000 (19:16 +0900)
committerHermet Park <chuneon.park@samsung.com>
Fri, 28 Aug 2020 10:19:23 +0000 (19:19 +0900)
free dash outline stroke data memory properly.

Change-Id: I25bebc38c2d6d7f69d04f6288a5b6863324b70d6

src/lib/sw_engine/tvgSwShape.cpp

index d2687de..b738f89 100644 (file)
@@ -618,11 +618,13 @@ void shapeResetStroke(SwShape* shape, const Shape* sdata, const Matrix* transfor
 bool shapeGenStrokeRle(SwShape* shape, const Shape* sdata, const Matrix* transform, const SwSize& clip)
 {
     SwOutline* shapeOutline = nullptr;
+    bool freeOutline = false;
 
     //Dash Style Stroke
     if (sdata->strokeDash(nullptr) > 0) {
         shapeOutline = _genDashOutline(sdata, transform);
         if (!shapeOutline) return false;
+        freeOutline = true;
     //Normal Style stroke
     } else {
         if (!shape->outline) {
@@ -643,6 +645,7 @@ bool shapeGenStrokeRle(SwShape* shape, const Shape* sdata, const Matrix* transfo
 
     shape->strokeRle = rleRender(strokeOutline, bbox, clip, true);
 
+    if (freeOutline) _delOutline(shapeOutline);
     _delOutline(strokeOutline);
 
     return true;