[Groonga-commit] groonga/groonga at 5ecc33f [master] select: fix a memory leak on drilldown ShortText value with --filter

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Nov 16 15:52:56 JST 2014


Kouhei Sutou	2014-11-16 15:52:56 +0900 (Sun, 16 Nov 2014)

  New Revision: 5ecc33f994c4ffb67850994eb3ffd8486530e873
  https://github.com/groonga/groonga/commit/5ecc33f994c4ffb67850994eb3ffd8486530e873

  Message:
    select: fix a memory leak on drilldown ShortText value with --filter

  Added files:
    test/command/suite/select/drilldown/filtered/short_text.expected
    test/command/suite/select/drilldown/filtered/short_text.test
  Modified files:
    lib/db.c

  Modified: lib/db.c (+5 -3)
===================================================================
--- lib/db.c    2014-11-16 15:37:16 +0900 (6ed0478)
+++ lib/db.c    2014-11-16 15:52:56 +0900 (b6447b3)
@@ -2988,6 +2988,7 @@ accelerated_table_group(grn_ctx *ctx, grn_obj *table, grn_obj *key, grn_obj *res
       int idp = GRN_OBJ_TABLEP(range);
       grn_table_cursor *tc;
       if ((tc = grn_table_cursor_open(ctx, table, NULL, 0, NULL, 0, 0, -1, 0))) {
+        grn_bool processed = GRN_TRUE;
         switch (a->next->obj->header.type) {
         case GRN_COLUMN_FIX_SIZE :
           {
@@ -3048,14 +3049,15 @@ accelerated_table_group(grn_ctx *ctx, grn_obj *table, grn_obj *key, grn_obj *res
               }
             }
           } else {
-            return GRN_FALSE;
+            processed = GRN_FALSE;
           }
           break;
         default :
-          return GRN_FALSE;
+          processed = GRN_FALSE;
+          break;
         }
         grn_table_cursor_close(ctx, tc);
-        return GRN_TRUE;
+        return processed;
       }
     }
   }

  Added: test/command/suite/select/drilldown/filtered/short_text.expected (+88 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/drilldown/filtered/short_text.expected    2014-11-16 15:52:56 +0900 (cd0be9d)
@@ -0,0 +1,88 @@
+table_create Memos TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Memos tag COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"_key": "Groonga is fast!", "tag": "Groonga"},
+{"_key": "Mroonga is fast!", "tag": "Mroonga"},
+{"_key": "Groonga sticker!", "tag": "Groonga"},
+{"_key": "Rroonga is fast!", "tag": "Rroonga"}
+]
+[[0,0.0,0.0],4]
+select Memos --filter true --drilldown tag
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        4
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "tag",
+          "ShortText"
+        ]
+      ],
+      [
+        1,
+        "Groonga is fast!",
+        "Groonga"
+      ],
+      [
+        2,
+        "Mroonga is fast!",
+        "Mroonga"
+      ],
+      [
+        3,
+        "Groonga sticker!",
+        "Groonga"
+      ],
+      [
+        4,
+        "Rroonga is fast!",
+        "Rroonga"
+      ]
+    ],
+    [
+      [
+        3
+      ],
+      [
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "_nsubrecs",
+          "Int32"
+        ]
+      ],
+      [
+        "Groonga",
+        2
+      ],
+      [
+        "Mroonga",
+        1
+      ],
+      [
+        "Rroonga",
+        1
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/drilldown/filtered/short_text.test (+12 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/drilldown/filtered/short_text.test    2014-11-16 15:52:56 +0900 (27edbe7)
@@ -0,0 +1,12 @@
+table_create Memos TABLE_HASH_KEY ShortText
+column_create Memos tag COLUMN_SCALAR ShortText
+
+load --table Memos
+[
+{"_key": "Groonga is fast!", "tag": "Groonga"},
+{"_key": "Mroonga is fast!", "tag": "Mroonga"},
+{"_key": "Groonga sticker!", "tag": "Groonga"},
+{"_key": "Rroonga is fast!", "tag": "Rroonga"}
+]
+
+select Memos --filter true --drilldown tag
-------------- next part --------------
HTML����������������������������...
Descargar 



More information about the Groonga-commit mailing list
Back to archive index