[Groonga-commit] groonga/groonga at 360e3a7 [master] Fix a memory leak for "VECTOR_COLUMN != xxx" expression

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Mon May 20 18:44:08 JST 2013


Kouhei Sutou	2013-05-20 18:44:08 +0900 (Mon, 20 May 2013)

  New Revision: 360e3a7d3cc05397e5fcf32f0bf7b1ae90ca16cd
  https://github.com/groonga/groonga/commit/360e3a7d3cc05397e5fcf32f0bf7b1ae90ca16cd

  Message:
    Fix a memory leak for "VECTOR_COLUMN != xxx" expression
    
    The added test can check the memory leak but the feature isn't
    implemented yet. :p

  Added files:
    test/command/suite/select/filter/vector/not_equal.expected
    test/command/suite/select/filter/vector/not_equal.test
  Modified files:
    lib/expr.c

  Modified: lib/expr.c (+1 -2)
===================================================================
--- lib/expr.c    2013-05-20 18:40:23 +0900 (4016e7b)
+++ lib/expr.c    2013-05-20 18:44:08 +0900 (71c95f8)
@@ -3197,9 +3197,8 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
           grn_obj *x, *y;
           POP2ALLOC1(x, y, res);
           DO_EQ(x, y, r);
+          grn_obj_reinit(ctx, res, GRN_DB_INT32, 0);
           GRN_INT32_SET(ctx, res, 1 - r);
-          res->header.type = GRN_BULK;
-          res->header.domain = GRN_DB_INT32;
         }
         code++;
         break;

  Added: test/command/suite/select/filter/vector/not_equal.expected (+45 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/vector/not_equal.expected    2013-05-20 18:44:08 +0900 (e07090f)
@@ -0,0 +1,45 @@
+table_create Memos TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Memos tags COLUMN_VECTOR ShortText
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"_key": "groonga is very fast", "tags": ["groonga"]}
+]
+[[0,0.0,0.0],1]
+select Memos --filter 'tags != ["rroonga"]'
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        1
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "tags",
+          "ShortText"
+        ]
+      ],
+      [
+        1,
+        "groonga is very fast",
+        [
+          "groonga"
+        ]
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/filter/vector/not_equal.test (+10 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/vector/not_equal.test    2013-05-20 18:44:08 +0900 (6c397aa)
@@ -0,0 +1,10 @@
+table_create Memos TABLE_HASH_KEY ShortText
+column_create Memos tags COLUMN_VECTOR ShortText
+
+load --table Memos
+[
+{"_key": "groonga is very fast", "tags": ["groonga"]}
+]
+
+# TODO: support it!
+select Memos --filter 'tags != ["rroonga"]'
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る