소스 검색

Merge pull request #5529 from richardkchapman/embed-stream-leak

HPCC-11020 Leaking rows in the streamed embed plugins

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 11 년 전
부모
커밋
6637957591
5개의 변경된 파일13개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 0
      plugins/mysql/CMakeLists.txt
  2. 2 0
      plugins/pyembed/CMakeLists.txt
  3. 4 2
      plugins/pyembed/pyembed.cpp
  4. 2 0
      plugins/v8embed/CMakeLists.txt
  5. 4 2
      plugins/v8embed/v8embed.cpp

+ 1 - 0
plugins/mysql/CMakeLists.txt

@@ -56,6 +56,7 @@ if (USE_MYSQL)
     target_link_libraries ( mysqlembed
          ${MYSQL_LIBRARIES}
         eclrtl
+        roxiemem
         jlib
         )
   endif()

+ 2 - 0
plugins/pyembed/CMakeLists.txt

@@ -42,6 +42,7 @@ if (USE_PYTHON)
          ./../../rtl/include
          ./../../rtl/nbcd
          ./../../common/deftype
+         ./../../roxie/roxiemem
          ./../../system/jlib
        )
 
@@ -66,6 +67,7 @@ if (USE_PYTHON)
 
     target_link_libraries ( pyembed
         eclrtl
+        roxiemem
         jlib
         )
   endif()

+ 4 - 2
plugins/pyembed/pyembed.cpp

@@ -27,6 +27,7 @@
 #include "rtlds_imp.hpp"
 #include "rtlfield_imp.hpp"
 #include "nbcd.hpp"
+#include "roxiemem.hpp"
 
 #ifdef _WIN32
 #define EXPORT __declspec(dllexport)
@@ -994,7 +995,7 @@ PyObject* ECLDatasetIterator_iternext(PyObject *self)
     ECLDatasetIterator *p = (ECLDatasetIterator *)self;
     if (p->val)
     {
-        const byte *nextRow = (const byte *) p->val->ungroupedNextRow();
+        roxiemem::OwnedConstRoxieRow nextRow = p->val->ungroupedNextRow();
         if (!nextRow)
         {
             p->val->stop();
@@ -1005,7 +1006,8 @@ PyObject* ECLDatasetIterator_iternext(PyObject *self)
         {
             RtlFieldStrInfo dummyField("<row>", NULL, p->typeInfo);
             PythonNamedTupleBuilder tupleBuilder(NULL, &dummyField);
-            p->typeInfo->process(nextRow, nextRow, &dummyField, tupleBuilder);
+            const byte *brow = (const byte *) nextRow.get();
+            p->typeInfo->process(brow, brow, &dummyField, tupleBuilder);
             return tupleBuilder.getTuple(p->typeInfo);
         }
     }

+ 2 - 0
plugins/v8embed/CMakeLists.txt

@@ -39,6 +39,7 @@ if (USE_V8)
              ./../../rtl/nbcd
              ./../../rtl/include
              ./../../common/deftype
+             ./../../roxie/roxiemem
              ./../../system/jlib
         )
 
@@ -55,6 +56,7 @@ if (USE_V8)
 
     target_link_libraries ( v8embed
         ${V8_LIBRARIES}
+        roxiemem
         eclrtl
         jlib
         )

+ 4 - 2
plugins/v8embed/v8embed.cpp

@@ -26,6 +26,7 @@
 #include "rtlds_imp.hpp"
 #include "rtlfield_imp.hpp"
 #include "nbcd.hpp"
+#include "roxiemem.hpp"
 #include <vector>
 
 #ifdef _WIN32
@@ -644,11 +645,12 @@ public:
         int idx = 0;
         loop
         {
-            const byte *row = (const byte *) val->ungroupedNextRow();
+            roxiemem::OwnedConstRoxieRow row = val->ungroupedNextRow();
             if (!row)
                 break;
             JSObjectBuilder objBuilder(&dummyField);
-            typeInfo->process(row, row, &dummyField, objBuilder); // Creates a JS object from the incoming ECL row
+            const byte *brow = (const byte *) row.get();
+            typeInfo->process(brow, brow, &dummyField, objBuilder); // Creates a JS object from the incoming ECL row
             array->Set(idx++, objBuilder.getObject());
         }
         context->Global()->Set(v8::String::New(name), array);