[Groonga-commit] groonga/groonga at bd9c384 [master] Fix a memory leak on updating an empty var size column vector with the same value

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Nov 1 12:09:38 JST 2013


Kouhei Sutou	2013-11-01 12:09:38 +0900 (Fri, 01 Nov 2013)

  New Revision: bd9c3849483cb8c2a227495beb42332bc38f1bf0
  https://github.com/groonga/groonga/commit/bd9c3849483cb8c2a227495beb42332bc38f1bf0

  Message:
    Fix a memory leak on updating an empty var size column vector with the same value
    
    See the added test case for details.

  Added files:
    test/command/suite/load/vector/update/not_indexed/var_size/not_changed.expected
    test/command/suite/load/vector/update/not_indexed/var_size/not_changed.test
  Modified files:
    lib/db.c

  Modified: lib/db.c (+1 -1)
===================================================================
--- lib/db.c    2013-10-31 18:44:45 +0900 (bfdfb39)
+++ lib/db.c    2013-11-01 12:09:38 +0900 (f8c999b)
@@ -5214,7 +5214,7 @@ call_hook(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_obj *value, int flags)
       if ((ov && v && os == s && !memcmp(ov, v, s)) &&
           !(obj->header.type == GRN_COLUMN_FIX_SIZE &&
             grn_bulk_is_zero(ctx, value))) {
-        grn_bulk_fin(ctx, oldvalue);
+        grn_obj_close(ctx, oldvalue);
         return 0;
       }
     }

  Added: test/command/suite/load/vector/update/not_indexed/var_size/not_changed.expected (+46 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/load/vector/update/not_indexed/var_size/not_changed.expected    2013-11-01 12:09:38 +0900 (46c7a1c)
@@ -0,0 +1,46 @@
+table_create Bookmarks TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Bookmarks tags COLUMN_VECTOR ShortText
+[[0,0.0,0.0],true]
+load --table Bookmarks
+[
+{"_key": "http://groonga.org/", "tags": [""]},
+{"_key": "http://groonga.org/", "tags": [""]}
+]
+[[0,0.0,0.0],2]
+select Bookmarks
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        1
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "tags",
+          "ShortText"
+        ]
+      ],
+      [
+        1,
+        "http://groonga.org/",
+        [
+          ""
+        ]
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/load/vector/update/not_indexed/var_size/not_changed.test (+10 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/load/vector/update/not_indexed/var_size/not_changed.test    2013-11-01 12:09:38 +0900 (c073c71)
@@ -0,0 +1,10 @@
+table_create Bookmarks TABLE_HASH_KEY ShortText
+column_create Bookmarks tags COLUMN_VECTOR ShortText
+
+load --table Bookmarks
+[
+{"_key": "http://groonga.org/", "tags": [""]},
+{"_key": "http://groonga.org/", "tags": [""]}
+]
+
+select Bookmarks
-------------- next part --------------
HTML����������������������������...
다운로드 



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