You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ji...@apache.org on 2024/02/18 02:33:25 UTC

(doris-thirdparty) branch clucene updated: (fix)[mlk] if sb_getenc is unknown, then sb_stemmer_new API will leak memory (#193)

This is an automated email from the ASF dual-hosted git repository.

jianliangqi pushed a commit to branch clucene
in repository https://gitbox.apache.org/repos/asf/doris-thirdparty.git


The following commit(s) were added to refs/heads/clucene by this push:
     new df7e5d4017 (fix)[mlk] if sb_getenc is unknown, then sb_stemmer_new API will leak memory (#193)
df7e5d4017 is described below

commit df7e5d401725265ae05d85e4f1f317da078b89f7
Author: Vallish Pai <va...@gmail.com>
AuthorDate: Sun Feb 18 08:03:21 2024 +0530

    (fix)[mlk] if sb_getenc is unknown, then sb_stemmer_new API will leak memory (#193)
---
 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-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org