From 2c188290a65fe363be4e958990fbb113be361e9f Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 9 Jul 2023 12:08:41 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20error=E3=81=AE=E3=83=9D=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=82=BF=E5=91=A8=E3=82=8A=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mecab/src/mecab.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mecab/src/mecab.cpp b/src/mecab/src/mecab.cpp index 1f388f4..4e23b23 100644 --- a/src/mecab/src/mecab.cpp +++ b/src/mecab/src/mecab.cpp @@ -116,6 +116,7 @@ BOOL Mecab_load_with_userdic(Mecab *m, const char *dicdir, const char *userdic) free(argv); char *error; + error = (char *) malloc(sizeof(char) * (64 + strlen(dicdir) + (userdic == NULL ? 0 : strlen(userdic)))); if (userdic == NULL) { sprintf(error, "ERROR: Mecab_load() in mecab.cpp: Cannot open %s.\n", dicdir); } else { @@ -142,6 +143,8 @@ BOOL Mecab_load_with_userdic(Mecab *m, const char *dicdir, const char *userdic) return FALSE; } + free(error); + m->model = (void *) model; m->tagger = (void *) tagger; m->lattice = (void *) lattice;