/*
- * 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
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
+
#include "tvgSwCommon.h"
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;
free(mpool->strokeOutline);
mpool->strokeOutline = nullptr;
}
- delete(mpool);
+ free(mpool);
return nullptr;
}
free(p->types);
p->types = nullptr;
+ free(p->closed);
+ p->closed = nullptr;
+
p->cntrsCnt = p->reservedCntrsCnt = 0;
p->ptsCnt = p->reservedPtsCnt = 0;
free(p->types);
p->types = nullptr;
+ free(p->closed);
+ p->closed = nullptr;
+
p->cntrsCnt = p->reservedCntrsCnt = 0;
p->ptsCnt = p->reservedPtsCnt = 0;
}
mpool->strokeOutline = nullptr;
}
- delete(mpool);
+ free(mpool);
return true;
-}
\ No newline at end of file
+}