Navigation Menu

Skip to content

Commit

Permalink
Fix a bug that ctx for snippet isn't associated with DB
Browse files Browse the repository at this point in the history
Anonymous DB is assigned.
  • Loading branch information
kou committed Dec 14, 2012
1 parent 851498e commit 43b9de3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ha_mroonga.cpp
Expand Up @@ -1043,6 +1043,7 @@ MRN_API my_bool mroonga_snippet_init(UDF_INIT *initid, UDF_ARGS *args, char *mes
goto error;
}
grn_ctx_init(&snip_info->ctx, 0);
grn_db_create(&snip_info->ctx, NULL, 0);

for (i = 1; i < args->arg_count; i++) {
if (!args->args[i]) {
Expand All @@ -1061,6 +1062,7 @@ MRN_API my_bool mroonga_snippet_init(UDF_INIT *initid, UDF_ARGS *args, char *mes

error:
if (snip_info) {
grn_obj_close(&snip_info->ctx, grn_ctx_db(&snip_info->ctx));
grn_ctx_fin(&snip_info->ctx);
my_free(snip_info, MYF(0));
}
Expand Down Expand Up @@ -1157,6 +1159,7 @@ MRN_API void mroonga_snippet_deinit(UDF_INIT *initid)
grn_snip_close(&snip_info->ctx, snip_info->snippet);
}
snip_info->result_str.free();
grn_obj_close(&snip_info->ctx, grn_ctx_db(&snip_info->ctx));
grn_ctx_fin(&snip_info->ctx);
my_free(snip_info, MYF(0));
}
Expand Down

0 comments on commit 43b9de3

Please sign in to comment.