You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by jn...@apache.org on 2017/04/03 05:12:04 UTC

[4/9] drill git commit: DRILL-5368: Fix memory leak issue in DrillClientImpl::processServerMetaResult

DRILL-5368: Fix memory leak issue in DrillClientImpl::processServerMetaResult

Fix a small memory leak by doing local allocation instead since the
object doesn't escape the function.

close #790


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/0ded1d08
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/0ded1d08
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/0ded1d08

Branch: refs/heads/master
Commit: 0ded1d08297cf56c8e38f98a8c1cf3708c3a584c
Parents: b82177e
Author: Laurent Goujon <la...@dremio.com>
Authored: Mon Mar 20 10:55:17 2017 -0700
Committer: Jinfeng Ni <jn...@apache.org>
Committed: Fri Mar 31 15:32:06 2017 -0700

----------------------------------------------------------------------
 contrib/native/client/src/clientlib/drillClientImpl.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/0ded1d08/contrib/native/client/src/clientlib/drillClientImpl.cpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/clientlib/drillClientImpl.cpp b/contrib/native/client/src/clientlib/drillClientImpl.cpp
index 7e169e9..30a354e 100644
--- a/contrib/native/client/src/clientlib/drillClientImpl.cpp
+++ b/contrib/native/client/src/clientlib/drillClientImpl.cpp
@@ -1364,15 +1364,15 @@ status_t DrillClientImpl::processServerMetaResult(AllocatedBufferPtr allocatedBu
     std::map<int,DrillClientQueryHandle*>::const_iterator it=this->m_queryHandles.find(msg.m_coord_id);
     if(it!=this->m_queryHandles.end()){
         DrillClientServerMetaHandle* pHandle=static_cast<DrillClientServerMetaHandle*>((*it).second);
-        exec::user::GetServerMetaResp* resp = new exec::user::GetServerMetaResp();
         DRILL_MT_LOG(DRILL_LOG(LOG_TRACE)  << "Received GetServerMetaResp result Handle " << msg.m_pbody.size() << std::endl;)
-        if (!(resp->ParseFromArray(msg.m_pbody.data(), msg.m_pbody.size()))) {
+        exec::user::GetServerMetaResp resp;
+        if (!(resp.ParseFromArray(msg.m_pbody.data(), msg.m_pbody.size()))) {
             return handleQryError(QRY_COMM_ERROR, "Cannot decode GetServerMetaResp results", pHandle);
         }
-        if (resp->status() != exec::user::OK) {
-            return handleQryError(QRY_FAILED, resp->error(), pHandle);
+        if (resp.status() != exec::user::OK) {
+            return handleQryError(QRY_FAILED, resp.error(), pHandle);
         }
-        pHandle->notifyListener(&(resp->server_meta()), NULL);
+        pHandle->notifyListener(&(resp.server_meta()), NULL);
         DRILL_MT_LOG(DRILL_LOG(LOG_DEBUG) << "GetServerMetaResp result " << std::endl;)
     }else{
         return handleQryError(QRY_INTERNAL_ERROR, getMessage(ERR_QRY_INVQUERYID), NULL);