Skip to content

Commit

Permalink
refs #159: fixed a memory leak problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kray-G committed Jan 25, 2021
1 parent 8246bb7 commit 1384f68
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/allocator.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ static void gc_mark_fnc(kx_fnc_t *c)
gc_mark_frm(c->lex);
}
gc_mark_val(&(c->val));
gc_mark_val(&(c->push));
}

static void gc_mark_frm(kx_frm_t *c)
Expand Down
5 changes: 4 additions & 1 deletion src/ir_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ kx_context_t *compile_code(const char *code, int exc_in_err)
return NULL;
}
} else {
context_cleanup(ctx);
return NULL;
}
}
Expand Down Expand Up @@ -658,8 +659,8 @@ void thread_free(void *pp)
kx_thread_pack_t *p = (kx_thread_pack_t *)pp;
if (p->r) {
pthread_join(p->r, NULL);
kx_free(p);
}
kx_free(p);
}

int System_threadIsRunning(int args, kx_frm_t *frmv, kx_frm_t *lexv, kx_context_t *ctx)
Expand Down Expand Up @@ -702,8 +703,10 @@ int System_joinThread(int args, kx_frm_t *frmv, kx_frm_t *lexv, kx_context_t *ct
kx_thread_pack_t *p = (kx_thread_pack_t *)(val->value.av->p);
if (p->r) {
pthread_join(p->r, NULL);
p->r = 0;
ret = p->value;
}
thread_free(val->value.av->p);
val->value.av->p = NULL;
}
KX_ADJST_STACK();
Expand Down

0 comments on commit 1384f68

Please sign in to comment.