From: 박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 Date: Wed, 19 Sep 2018 06:44:54 +0000 (+0900) Subject: [refNN] Fix possible memory leak (#1563) X-Git-Tag: nncc_backup~1761 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c3e6b768ca39c42d48bdbad5b5488b17aaeb7728;p=platform%2Fcore%2Fml%2Fnnfw.git [refNN] Fix possible memory leak (#1563) In the current implementation, allocated event object will be leaked if startCompute failed. Signed-off-by: Jonghyun Park --- 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; }