sw_engine stroke: fix memory leak.
authorHermet Park <chuneon.park@samsung.com>
Thu, 10 Dec 2020 02:48:08 +0000 (11:48 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Fri, 11 Dec 2020 01:07:13 +0000 (10:07 +0900)
Properly free data after use.

@Issues: 178

Change-Id: I085fd936081c82f9ea4d332979a90fe276d0e0cc

src/lib/sw_engine/tvgSwShape.cpp

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