trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hzel...@apache.org
Subject [1/2] incubator-trafodion git commit: [TRAFODION-2636] Memory leak in metadata context
Date Wed, 07 Jun 2017 19:03:55 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 5c0abc96e -> dbd078c15


[TRAFODION-2636] Memory leak in metadata context

Fixing a memory leak found by Selva.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/9dd45d25
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/9dd45d25
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/9dd45d25

Branch: refs/heads/master
Commit: 9dd45d251fda6a103c5d90b6706babbea55f32fa
Parents: 78a8390
Author: Hans Zeller <hzeller@apache.org>
Authored: Wed Jun 7 15:43:23 2017 +0000
Committer: Hans Zeller <hzeller@apache.org>
Committed: Wed Jun 7 15:43:23 2017 +0000

----------------------------------------------------------------------
 core/sql/common/NAMemory.h       | 5 +++++
 core/sql/optimizer/ControlDB.cpp | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9dd45d25/core/sql/common/NAMemory.h
----------------------------------------------------------------------
diff --git a/core/sql/common/NAMemory.h b/core/sql/common/NAMemory.h
index 270289e..a37a5da 100644
--- a/core/sql/common/NAMemory.h
+++ b/core/sql/common/NAMemory.h
@@ -468,6 +468,11 @@ NA_EIDPROC
   NAMemoryType getType() {  return type_; }
 NA_EIDPROC
   NABoolean getUsage(size_t* lastSegSize, size_t* freeSize, size_t* totalSize);
+  // for debugging
+NA_EIDPROC
+  NABoolean containsAddress(void *addr)
+        { return NABlock::blockHolding(firstBlk_, addr) != NULL; }
+
   // #ifdef NA_WINNT
 #ifndef __EID
   NABoolean  getSharedMemory() { return sharedMemory_; }

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9dd45d25/core/sql/optimizer/ControlDB.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/ControlDB.cpp b/core/sql/optimizer/ControlDB.cpp
index adfcd16..ceab262 100644
--- a/core/sql/optimizer/ControlDB.cpp
+++ b/core/sql/optimizer/ControlDB.cpp
@@ -108,7 +108,12 @@ ControlDB::~ControlDB()
 
 void ControlDB::setRequiredShape(ControlQueryShape *shape)
 {
-  delete requiredShape_;
+  if (requiredShape_)
+    {
+      delete requiredShape_->getShape();
+      delete requiredShape_;
+    }
+
   if (!shape
 	  ||
 	  !shape->getShape()


Mime
View raw message