From 1499ca7ec8695a73077587acaabaafac29616969 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Thu, 6 Dec 2018 12:44:03 +0900 Subject: [PATCH] [coco] Fix a USE-AFTER-FREE bug in OpHelper test (#2519) The current OpHelper test may access a freed Op object during 'teardown'. Signed-off-by: Jonghyun Park --- contrib/coco/core/src/IR/Ops.test.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/contrib/coco/core/src/IR/Ops.test.cpp b/contrib/coco/core/src/IR/Ops.test.cpp index d5f4192..61fa893 100644 --- a/contrib/coco/core/src/IR/Ops.test.cpp +++ b/contrib/coco/core/src/IR/Ops.test.cpp @@ -16,6 +16,7 @@ #include "coco/IR/Ops.h" #include "coco/IR/ObjectManager.h" +#include "coco/IR/OpManager.h" #include #include @@ -91,18 +92,13 @@ public: } protected: - template Op *allocate(void) - { - auto op = new Op; - _allocated.emplace_back(op); - return op; - } + template Op *allocate(void) { return op_mgr.create(); } protected: coco::ObjectManager obj_mgr; private: - std::vector> _allocated; + coco::OpManager op_mgr; }; } // namespace -- 2.7.4