Fix memory leak in SSM processQueryResult.
authorAnkur Bansal <ankur.b1@samsung.com>
Sat, 4 Jul 2015 09:16:35 +0000 (14:46 +0530)
committerUze Choi <uzchoi@samsung.com>
Mon, 6 Jul 2015 02:42:40 +0000 (02:42 +0000)
Update logic in CQueryEngine::processQueryResult to free
pDataReader in case of error.

Change-Id: I14cb27cd5c56731632fc6288cec555807f96ba97
Signed-off-by: Ankur Bansal <ankur.b1@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1520
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Minji Park <minjii.park@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/soft-sensor-manager/SSMCore/src/QueryProcessor/QueryEngine.cpp

index 765fe06da9177c05403d71f45da677204d35806d..4392b8fb35a013e05471ef4acc413ca872f4c3aa 100644 (file)
@@ -163,6 +163,7 @@ SSMRESULT CQueryEngine::processQueryResult(int userTriggerId,
     pData[0] = EVENT_TYPE_OUTER;
     pData[1] = userTriggerId;
     pData[2] = reinterpret_cast<intptr_t>(pDataReader);
+    pDataReader = NULL;
 
     m_pTasker->addTask(this, (void *)pData);
 
@@ -170,6 +171,7 @@ SSMRESULT CQueryEngine::processQueryResult(int userTriggerId,
 
 CLEANUP:
     m_mtxQueries.unlock();
+    SAFE_DELETE(pDataReader);
     SAFE_RELEASE(temp_contextmodel);
     SAFE_RELEASE(temp_contextmodel2);
     return res;