Tcl_SetBignumObj memory leak
Closed / Fixed1299803fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-09-23 04:46:39
End of the Tcl_SetBignumObj routine:
/* Clear the value with mp_init; mp_clear
overwrites the digit array. */
mp_init(bignumValue);
(Same issue in Tcl_NewBignumObj)
The comment suggests that our intent
is to free the memory of the bignumValue
passed in, while not freeing the digit array
that's been transferred to the intrep of
the Tcl_Obj. This intent would allow
callers of Tcl_(Set|New)BignumObj
to not have to worry about calling mp_clear.
They can think of these functions as
transferring ownership of their mp_int
value to Tcl.
Trouble is that mp_init() allocates
a minimum-sized digit array of
MP_PREC mp_digits. This digit
array is being leaked.
There's a fix for this on the
numerics-branch, and these
routines aren't actually used
on the HEAD yet. A better
numerics branch fix, followed by
merge onto the HEAD is the
way forward.
dgpplain2005-09-23 23:24:40
Logged In: YES user_id=80530 improved fix now on numerics branch.
dgpplain2005-10-14 00:46:48
Logged In: YES user_id=80530 fixed by the TIP 237 merge.
Log in (anonymous is fine) to add a comment.