[Groonga-commit] groonga/groonga at 80d5ed3 [master] Add dangling hook reference check

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Jul 30 23:50:36 JST 2013


Kouhei Sutou	2013-07-30 23:50:36 +0900 (Tue, 30 Jul 2013)

  New Revision: 80d5ed3a854fcf6e7b9ac6b3ed3180afd04481f6
  https://github.com/groonga/groonga/commit/80d5ed3a854fcf6e7b9ac6b3ed3180afd04481f6

  Message:
    Add dangling hook reference check
    
    Normally, the case is not occurred. (So I couldn't add a test for the
    case. :<) It makes groonga more robust.

  Modified files:
    lib/db.c

  Modified: lib/db.c (+8 -1)
===================================================================
--- lib/db.c    2013-07-30 23:12:39 +0900 (e7ed8fb)
+++ lib/db.c    2013-07-30 23:50:36 +0900 (eb0bdf6)
@@ -6554,7 +6554,14 @@ remove_index(grn_ctx *ctx, grn_obj *obj, grn_hook_entry entry)
   while (hooks) {
     default_set_value_hook_data *data = (void *)NEXT_ADDR(hooks);
     grn_obj *target = grn_ctx_at(ctx, data->target);
-    if (target->header.type == GRN_COLUMN_INDEX) {
+    if (!target) {
+      char name[GRN_TABLE_MAX_KEY_SIZE];
+      int length;
+      length = grn_obj_name(ctx, obj, name, GRN_TABLE_MAX_KEY_SIZE);
+      ERR(GRN_UNKNOWN_ERROR,
+          "[column][remove][index] "
+          "hook has a dangling reference: %.*s", length, name);
+    } else if (target->header.type == GRN_COLUMN_INDEX) {
       //TODO: multicolumn  MULTI_COLUMN_INDEXP
       _grn_obj_remove(ctx, target);
     } else {
-------------- next part --------------
HTML����������������������������...
Download 



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