From c3e6b768ca39c42d48bdbad5b5488b17aaeb7728 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: Wed, 19 Sep 2018 15:44:54 +0900 Subject: [PATCH] [refNN] Fix possible memory leak (#1563) In the current implementation, allocated event object will be leaked if startCompute failed. Signed-off-by: Jonghyun Park --- contrib/ann/runtimes/ref/src/NeuralNetworks.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contrib/ann/runtimes/ref/src/NeuralNetworks.cpp b/contrib/ann/runtimes/ref/src/NeuralNetworks.cpp index 186647b..38a7f2f 100644 --- a/contrib/ann/runtimes/ref/src/NeuralNetworks.cpp +++ b/contrib/ann/runtimes/ref/src/NeuralNetworks.cpp @@ -316,13 +316,12 @@ int ANeuralNetworksExecution_startCompute(ANeuralNetworksExecution *execution, // object. *event = nullptr; - int *e = new int; int n = r->startCompute(); if (n != ANEURALNETWORKS_NO_ERROR) { return n; } - *event = reinterpret_cast(e); + *event = reinterpret_cast(new int); return ANEURALNETWORKS_NO_ERROR; } -- 2.7.4