This is an automated email from the ASF dual-hosted git repository. jianliangqi pushed a commit to branch clucene-2.0 in repository https://gitbox.apache.org/repos/asf/doris-thirdparty.git
The following commit(s) were added to refs/heads/clucene-2.0 by this push: new 41c485c55d [fix](mlk) if sb_getenc is unknown, then sb_stemmer_new API will leak memory (#194) 41c485c55d is described below commit 41c485c55dad8d9c6ed8ab0147c3633a3cf27cec Author: Vallish Pai <vallish...@gmail.com> AuthorDate: Sun Feb 18 11:57:12 2024 +0530 [fix](mlk) if sb_getenc is unknown, then sb_stemmer_new API will leak memory (#194) --- src/contribs-lib/CLucene/snowball/libstemmer/libstemmer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/contribs-lib/CLucene/snowball/libstemmer/libstemmer.c b/src/contribs-lib/CLucene/snowball/libstemmer/libstemmer.c index 77da8db910..49169db906 100644 --- a/src/contribs-lib/CLucene/snowball/libstemmer/libstemmer.c +++ b/src/contribs-lib/CLucene/snowball/libstemmer/libstemmer.c @@ -39,7 +39,11 @@ sb_stemmer_new(const char * algorithm, const char * charenc) (struct sb_stemmer *) malloc(sizeof(struct sb_stemmer)); if (stemmer == NULL) return NULL; enc = sb_getenc(charenc); - if (enc == ENC_UNKNOWN) return NULL; + if (enc == ENC_UNKNOWN) + { + free(stemmer); + return NULL; + } for (module = modules; module->name != 0; module++) { if (strcmp(module->name, algorithm) == 0 && module->enc == enc) break; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org