Kouhei Sutou
null+****@clear*****
Mon Aug 17 15:59:43 JST 2015
Kouhei Sutou 2015-08-17 15:59:43 +0900 (Mon, 17 Aug 2015) New Revision: eb3b95989caa6fbdc80f57a24835f628fdcee41d https://github.com/groonga/groonga/commit/eb3b95989caa6fbdc80f57a24835f628fdcee41d Message: Fix a memory leak on error while evaluating complex expression Complex expression means that temporary table is needed to evaluate the expression. For example, "(AAA || BBB) && (CCC || DDD)" needs a temporary table. Modified files: lib/expr.c Modified: lib/expr.c (+7 -7) =================================================================== --- lib/expr.c 2015-08-17 15:58:26 +0900 (dd895cb) +++ lib/expr.c 2015-08-17 15:59:43 +0900 (c654469) @@ -5499,13 +5499,6 @@ grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr, res_ = grn_table_create(ctx, NULL, 0, NULL, GRN_TABLE_HASH_KEY|GRN_OBJ_WITH_SUBREC, table, NULL); if (!res_) { - int i = 0; - if (!res_created) { i++; } - for (; i < GRN_BULK_VSIZE(&res_stack) / sizeof(grn_obj *); i++) { - grn_obj *stacked_res; - stacked_res = *((grn_obj **)GRN_BULK_HEAD(&res_stack) + i); - grn_obj_close(ctx, stacked_res); - } break; } GRN_PTR_PUT(ctx, &res_stack, res); @@ -5534,6 +5527,13 @@ grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr, scan_info *si = sis[i]; SI_FREE(si); } + i = 0; + if (!res_created) { i++; } + for (; i < GRN_BULK_VSIZE(&res_stack) / sizeof(grn_obj *); i++) { + grn_obj *stacked_res; + stacked_res = *((grn_obj **)GRN_BULK_HEAD(&res_stack) + i); + grn_obj_close(ctx, stacked_res); + } GRN_OBJ_FIN(ctx, &res_stack); GRN_FREE(sis); e->codes = codes; -------------- next part -------------- HTML����������������������������...Download