Permalink
Browse files

[PMC] Fixed a memory leak in the NCI PMC introduced in r32463. Also f…

…ixed a

bug in cloning NCI PMCs, where the clone received the wrong information about
the JITtedness of the source PMC.

Note that JITted NCI functions leak horribly at the moment.

git-svn-id: https://svn.parrot.org/parrot/trunk@32464 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 03918bc commit 37fe63929e5c36ce4eab3c850be02131e8ac4c2b @chromatic chromatic committed Nov 9, 2008
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/pmc/nci.pmc
View
@@ -84,11 +84,11 @@ void pcc_params(PARROT_INTERP, STRING *sig, Parrot_NCI_attributes * const nci_in
if (j) {
nci_info->pcc_params_signature = string_make(interp, param_sig, j,
NULL, PObj_constant_FLAG);
- mem_sys_free(param_sig);
}
else
nci_info->pcc_params_signature = CONST_STRING(interp, "");
+ mem_sys_free(param_sig);
string_cstring_free(sig_c);
}
@@ -254,7 +254,7 @@ Creates and returns a clone of the NCI.
nci_info_ret->signature = nci_info_self->signature;
nci_info_ret->pcc_params_signature = nci_info_self->pcc_params_signature;
nci_info_ret->arity = nci_info_self->arity;
- nci_info_ret->jitted = nci_info_self->arity;
+ nci_info_ret->jitted = nci_info_self->jitted;
PObj_get_FLAGS(ret) |= (PObj_get_FLAGS(SELF) & 0x7);
return ret;
@@ -308,7 +308,8 @@ shifted down.
nci_jit_sub_t jit_func = (nci_jit_sub_t) D2FPTR(nci_info->func);
/* Parrot_eprintf(interp, "JITTED %S\n", nci_info->signature); */
- jit_func(INTERP, SELF, (char *) nci_info->pcc_params_signature->strstart);
+ jit_func(INTERP, SELF,
+ (char *) nci_info->pcc_params_signature->strstart);
}
else {
if (PObj_flag_TEST(private2, SELF)) {
@@ -383,7 +384,8 @@ Return the arity of the NCI (the number of arugments).
if (nci_info && nci_info->func)
arity = nci_info->arity;
else
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
+ Parrot_ex_throw_from_c_args(INTERP, NULL,
+ EXCEPTION_INVALID_OPERATION,
"You cannot get the arity of an undefined NCI.");
RETURN(INTVAL arity);

0 comments on commit 37fe639

Please sign in to comment.