Skip to content

Commit

Permalink
(fix)(mlk) if sb_getenc is unknown, then sb_stemmer_new API will leak…
Browse files Browse the repository at this point in the history
… memory
  • Loading branch information
Vallishp committed Feb 15, 2024
1 parent 305e6ab commit 694d503
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/contribs-lib/CLucene/snowball/libstemmer/libstemmer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 694d503

Please sign in to comment.