diff --git a/lib/sj4core/getcost.c b/lib/sj4core/getcost.c index 4976079..32cdea0 100644 --- a/lib/sj4core/getcost.c +++ b/lib/sj4core/getcost.c @@ -5,7 +5,7 @@ static void getcost_atrb(SJ4_CONTEXT u_char* p, int* len) { } static int getcost_ofs(SJ4_CONTEXT u_char* p, int* len) { - *len = 0; + *len = 2; return getcost(SJ4_CONTEXT_PASS dicbuf + ((*p & KANJICODEMASK) << 8) + *(p + 1)); } diff --git a/lib/sj4core/sdepend.c b/lib/sj4core/sdepend.c index 0371038..253cf05 100644 --- a/lib/sj4core/sdepend.c +++ b/lib/sj4core/sdepend.c @@ -239,6 +239,7 @@ static void mkdicskip(DictFile* dp) { free((char*)stack); free((char*)ents); free((char*)segs); + return; } for(seg = 0; seg < dp->dict.segunit; seg++) { @@ -437,6 +438,7 @@ int closedict(SJ4_CONTEXT DictFile* dfp) { if(dfp->fp) fclose(dfp->fp); + freedicskip(dfp); free((char*)(dfp->ofsptr)); free((char*)(dfp->buffer)); free((char*)dfp); diff --git a/lib/sj4core/srchdict.c b/lib/sj4core/srchdict.c index 310a3ce..b685d44 100644 --- a/lib/sj4core/srchdict.c +++ b/lib/sj4core/srchdict.c @@ -158,9 +158,7 @@ u_char* srchdict(SJ4_CONTEXT u_char* tagp) { segno = srchidx_loaded(SJ4_CONTEXT_PASS prevseg, (int)dicinl); (*curdict->getdic)(SJ4_CONTEXT_PASS curdict, segno); - if(prevseg != segno) { - (*curdict->getdic)(SJ4_CONTEXT_PASS curdict, segno); prevseg = segno; segidx = idxbuf + idxofs[segno];