Kouhei Sutou
null+****@clear*****
Wed Sep 26 00:14:52 JST 2012
Kouhei Sutou 2012-09-26 00:14:52 +0900 (Wed, 26 Sep 2012) New Revision: 1d06e1e7ad2a8abe6b39d7cf32cce1330aed1e6f https://github.com/groonga/groonga/commit/1d06e1e7ad2a8abe6b39d7cf32cce1330aed1e6f Log: Fix a memory leak on loading no tokenizer indexed value This also fixes crash by grn_token_close(NULL). This bug was introduced in 75d4942f66fa4eac8f7c31f3efd7209dcdc20898 at Fri May 25 16:22:03 2012 +0900. Added files: test/function/suite/load/index/no-tokenizer.expected test/function/suite/load/index/no-tokenizer.test Modified files: lib/token.c Modified: lib/token.c (+3 -3) =================================================================== --- lib/token.c 2012-09-25 23:58:52 +0900 (3cb8279) +++ lib/token.c 2012-09-26 00:14:52 +0900 (4fce9bb) @@ -581,12 +581,12 @@ grn_token_close(grn_ctx *ctx, grn_token *token) ((grn_proc *)token->tokenizer)->funcs[PROC_FIN](ctx, 1, &token->table, &token->pctx.user_data); } - GRN_FREE(token); - return GRN_SUCCESS; - } else { if (token->nstr) { grn_obj_close(ctx, token->nstr); } + GRN_FREE(token); + return GRN_SUCCESS; + } else { return GRN_INVALID_ARGUMENT; } } Added: test/function/suite/load/index/no-tokenizer.expected (+14 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/load/index/no-tokenizer.expected 2012-09-26 00:14:52 +0900 (d8c63df) @@ -0,0 +1,14 @@ +table_create Users TABLE_HASH_KEY --key_type ShortText +[[0,0.0,0.0],true] +column_create Users age COLUMN_SCALAR UInt8 +[[0,0.0,0.0],true] +table_create Numbers TABLE_PAT_KEY --key_type UInt8 +[[0,0.0,0.0],true] +column_create Numbers age_index COLUMN_INDEX Users age +[[0,0.0,0.0],true] +load --table Users +[ +["_key","age"], +["mori",41] +] +[[0,0.0,0.0],1] Added: test/function/suite/load/index/no-tokenizer.test (+11 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/load/index/no-tokenizer.test 2012-09-26 00:14:52 +0900 (6246bd4) @@ -0,0 +1,11 @@ +table_create Users TABLE_HASH_KEY --key_type ShortText +column_create Users age COLUMN_SCALAR UInt8 + +table_create Numbers TABLE_PAT_KEY --key_type UInt8 +column_create Numbers age_index COLUMN_INDEX Users age + +load --table Users +[ +["_key","age"], +["mori",41] +] -------------- next part -------------- HTML����������������������������... Descargar