some fixes
This commit is contained in:
parent
f11fb85d8e
commit
9c671b8527
3 changed files with 16 additions and 16 deletions
|
|
@ -82,21 +82,21 @@ Sj4Context* alloccontext(const char* dic) {
|
|||
if(ctx == NULL) return NULL;
|
||||
|
||||
if((ctx->work = calloc(1, sizeof(*ctx->work))) == NULL) {
|
||||
free(ctx);
|
||||
free((char*)ctx);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
if((ctx->stdy = calloc(1, sizeof(*ctx->stdy))) == NULL) {
|
||||
free(ctx->work);
|
||||
free(ctx);
|
||||
free((char*)ctx->work);
|
||||
free((char*)ctx);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if((node = calloc(1, sizeof(*node))) == NULL) {
|
||||
free(ctx->stdy);
|
||||
free(ctx->work);
|
||||
free(ctx);
|
||||
free((char*)ctx->stdy);
|
||||
free((char*)ctx->work);
|
||||
free((char*)ctx);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -128,19 +128,19 @@ void free_context(Sj4Context* ctx) {
|
|||
DICTL* next = node->next;
|
||||
|
||||
if(node->dict != NULL) closedict(ctx, (DictFile*)node->dict);
|
||||
free(node);
|
||||
free((char*)node);
|
||||
|
||||
node = next;
|
||||
}
|
||||
|
||||
freework(ctx);
|
||||
|
||||
if(ctx->jrec_pool != NULL) free(ctx->jrec_pool);
|
||||
if(ctx->clrec_pool != NULL) free(ctx->clrec_pool);
|
||||
if(ctx->jrec_pool != NULL) free((char*)ctx->jrec_pool);
|
||||
if(ctx->clrec_pool != NULL) free((char*)ctx->clrec_pool);
|
||||
|
||||
free(ctx->stdy);
|
||||
free(ctx->work);
|
||||
free((char*)ctx->stdy);
|
||||
free((char*)ctx->work);
|
||||
|
||||
free(ctx);
|
||||
free((char*)ctx);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ Sj4Ime* sj4_ime(int charset, const char* dict, Sj4ImePacket packet) {
|
|||
if((ime = calloc(1, sizeof(*ime))) == NULL) return NULL;
|
||||
|
||||
if((ime->lib = sj4_open(charset, dict)) == NULL) {
|
||||
free(ime);
|
||||
free((char*)ime);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -236,5 +236,5 @@ void* sj4_ime_convbuf(Sj4Ime* ime) {
|
|||
|
||||
void sj4_ime_close(Sj4Ime* ime) {
|
||||
sj4_close(ime->lib);
|
||||
free(ime);
|
||||
free((char*)ime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ Sj4Lib* sj4_open(int charset, const char* dic) {
|
|||
if((ctx = calloc(1, sizeof(*ctx))) == NULL) return NULL;
|
||||
|
||||
if((ctx->ctx = alloccontext(dic)) == NULL) {
|
||||
free(ctx);
|
||||
free((char*)ctx);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -96,5 +96,5 @@ int sj4_prevkan(Sj4Lib* ctx) {
|
|||
|
||||
void sj4_close(Sj4Lib* ctx) {
|
||||
free_context(ctx->ctx);
|
||||
free(ctx);
|
||||
free((char*)ctx);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue