Skip to content

Commit

Permalink
Fix: errorのポインタ周りを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Jul 9, 2023
1 parent 1788595 commit 2c18829
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mecab/src/mecab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down

0 comments on commit 2c18829

Please sign in to comment.