Doc/implementation mismatch for AssocData
Closed / Fixed218621ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:03:15
OriginalBugID: 1486 Bug
Version: 8.0.5
SubmitDate: '1999-03-11'
LastModified: '1999-04-09'
Severity: MED
Status: Released
Submitter: pat
ChangedBy: surles
OS: Linux-Red Hat
OSVersion: 5.1
Machine: Other
FixedDate: '1999-04-09'
FixedInVersion: 8.1b3
ClosedDate: '2000-10-25'
Name:
Bart Veer
Extensions:
None
CustomShell:
None.
ReproducibleScript:
The man page for Tcl_DeleteAssocData() states:
"Tcl_DeleteAssocData deletes an association with a specified key in
the given interpreter. It does not call the deletion procedure."
The implementation in generic/tclBasic.c contains:
dPtr = (AssocData *) Tcl_GetHashValue(hPtr);
if (dPtr->proc != NULL) {
(dPtr->proc) (dPtr->clientData, interp);
}
ObservedBehavior:
Application code that invoked Tcl_DeleteAssocData() also deleted the
clientdata, as per the documentation. This resulted in a double-free
attempt and heap corruption.
DesiredBehavior:
Tcl_DeleteAssocData() probably should delete the clientdata, for
consistency with e.g. Tcl_DeleteCommand(). Therefore the code is
correct, but the relevant line from the documentation needs to be
removed. Obviously this approach has the advantage of not changing the
behaviour of any existing code.
This problem is also present in Tcl8.1b1
---
04/09/1999 13:32 - surles - Changed the man page to say it DOES call the deletion proc.
welch Closed ticket [218621ffff].
[History diff]2000-10-26 08:25:11
dgp Ticket [218621ffff]: 3 changes
[History diff]2001-04-05 06:40:44
Log in (anonymous is fine) to add a comment.