updated copyright.
[platform/core/graphics/tizenvg.git] / src / lib / sw_engine / tvgSwMemPool.cpp
index ae051d8..a87b3fd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020-2021 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
 
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -19,6 +19,7 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
+
 #include "tvgSwCommon.h"
 
 
@@ -59,11 +60,9 @@ void mpoolRetStrokeOutline(SwMpool* mpool, unsigned idx)
 
 SwMpool* mpoolInit(unsigned threads)
 {
-    auto mpool = new SwMpool;
-    if (!mpool) return nullptr;
-
     if (threads == 0) threads = 1;
 
+    auto mpool = static_cast<SwMpool*>(calloc(sizeof(SwMpool), 1));
     mpool->outline = static_cast<SwOutline*>(calloc(1, sizeof(SwOutline) * threads));
     if (!mpool->outline) goto err;
 
@@ -84,7 +83,7 @@ err:
         free(mpool->strokeOutline);
         mpool->strokeOutline = nullptr;
     }
-    delete(mpool);
+    free(mpool);
     return nullptr;
 }
 
@@ -107,6 +106,9 @@ bool mpoolClear(SwMpool* mpool)
         free(p->types);
         p->types = nullptr;
 
+        free(p->closed);
+        p->closed = nullptr;
+
         p->cntrsCnt = p->reservedCntrsCnt = 0;
         p->ptsCnt = p->reservedPtsCnt = 0;
 
@@ -122,6 +124,9 @@ bool mpoolClear(SwMpool* mpool)
         free(p->types);
         p->types = nullptr;
 
+        free(p->closed);
+        p->closed = nullptr;
+
         p->cntrsCnt = p->reservedCntrsCnt = 0;
         p->ptsCnt = p->reservedPtsCnt = 0;
     }
@@ -146,7 +151,7 @@ bool mpoolTerm(SwMpool* mpool)
         mpool->strokeOutline = nullptr;
     }
 
-    delete(mpool);
+    free(mpool);
 
     return true;
-}
\ No newline at end of file
+}