Repository: incubator-trafodion
Updated Branches:
  refs/heads/master c0583c994 -> 5635e6399


[TRAFODION-2853] Memory leak of ComDiagsArea in Context

CLI entry points to LOB and Sequence generator didn't deallocate
the local diags area.


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

Branch: refs/heads/master
Commit: 84679539534747e52a18c07070011641062f8783
Parents: c0583c9
Author: selvaganesang <[email protected]>
Authored: Mon Dec 18 23:18:42 2017 +0000
Committer: selvaganesang <[email protected]>
Committed: Mon Dec 18 23:18:42 2017 +0000

----------------------------------------------------------------------
 core/sql/cli/Cli.cpp | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/84679539/core/sql/cli/Cli.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Cli.cpp b/core/sql/cli/Cli.cpp
index 3f88eac..be9181a 100644
--- a/core/sql/cli/Cli.cpp
+++ b/core/sql/cli/Cli.cpp
@@ -9222,8 +9222,10 @@ Lng32 SQLCLI_LOBcliInterface
        {
          diags.mergeAfter(*myDiags);
        }
-      return cliRC;
     }
+  myDiags->deAllocate();
+  if (cliRC < 0)
+     return cliRC;
   else if (cliRC == 100)
     return 100;
   else
@@ -9510,13 +9512,16 @@ Lng32 SQLCLI_LOB_GC_Interface
        {
          diags.mergeAfter(*myDiags);
        }
-      return cliRC;
     }
+  myDiags->deAllocate();
+  if (cliRC < 0)
+     return cliRC;
   else if (cliRC == 100)
     return 100;
   else
     return 0;   
 }
+
 Lng32 SQLCLI_LOBddlInterface
 (
 /*IN*/     CliGlobals *cliGlobals,
@@ -9924,8 +9929,10 @@ Lng32 SQLCLI_LOBddlInterface
        {
          diags.mergeAfter(*myDiags);
        }
-      return cliRC;
     }
+  myDiags->deAllocate();
+  if (cliRC < 0)
+     return cliRC;
   else if (cliRC == 100)
     return 100;
   else
@@ -10035,8 +10042,6 @@ Lng32 SQLCLI_SEcliInterface
   ContextCli   & currContext = *(cliGlobals->currContext());
   ComDiagsArea & diags       = currContext.diags();
 
-  ComDiagsArea * myDiags = ComDiagsArea::allocate(currContext.exHeap());
-
   ExeCliInterface *cliInterface = NULL;
   if (inCliInterface && (*inCliInterface))
     {
@@ -10711,8 +10716,10 @@ Lng32 SQLCLI_SeqGenCliInterface
                                                currContext.exHeap(),
                                                nextValue,
                                                endValue);
-  if (cliRC < 0)
-    return cliRC;
+  if (cliRC < 0) {
+     myDiags->deAllocate();     
+     return cliRC;
+  }
   
   if ((sga->getSGCycleOption()) &&
       (nextValue > sga->getSGMaxValue()))
@@ -10727,10 +10734,13 @@ Lng32 SQLCLI_SeqGenCliInterface
                                                    currContext.exHeap(),
                                                    nextValue,
                                                    endValue);
-      if (cliRC < 0)
-       return cliRC;
+      if (cliRC < 0) {
+         myDiags->deAllocate();     
+        return cliRC;
+      }
     }
 
+  myDiags->deAllocate();     
   sga->setSGNextValue(nextValue);
   sga->setSGEndValue(endValue);
 

Reply via email to