Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-19
03:29 • Closed ticket [218932ffff]: Tcl_Alloc behaviour differ from malloc plus 3 ot... artifact: 95d9748752 user: dgp
03:28 • Open ticket [218932ffff]. artifact: b8eb87bfb6 user: dgp
2000-10-26
08:32 • Closed ticket [218932ffff]. artifact: 4fff167d10 user: welch
01:08 • New ticket [218932ffff]. artifact: 23d1fa2d14 user: nobody

Tcl_Alloc behaviour differ from malloc

Closed / Fixed218932ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:08:06
OriginalBugID: 2807 RFE
Version: 8.2
SubmitDate: '1999-09-16'
LastModified: '1999-11-02'
Severity: MED
Status: Released
Submitter: techsupp
ChangedBy: hobbs
OS: Digital Unix
OSVersion: 4.0e
Machine: Other
FixedDate: '1999-11-02'
FixedInVersion: 8.2.1
ClosedDate: '2000-10-25'


Name:
Evelino Bomitali

CustomShell:
Modification to Tcl_Alloc

Comments:
The patch proposed is based on the assumption that Tcl_Alloc is
    substantially an enhanced version of malloc. Probably this is a better
    solution compared with the previous patch proposal.

ReproducibleScript:
The header of the file tclCkalloc.c claims that it is an interface to
    malloc that support some checking. However, Tcl_Alloc return an error
    for request for a zero size memory while malloc return a NULL pointer.

ObservedBehavior:
During execution of test "scan-3.4" in the standard test suite, a call
    to ckalloc (and hence Tcl_Alloc) with size equal to zero is made,
    resulting in a core dump.

Patch:
The solution I am proposing is to modify Tcl_Alloc such that it return a NULL pointer if the size of memory requested is zero.
800c800,803
<
---
>
>       if (size == 0) {
>          return NULL;
>       }
813a817,820
>
>       if (size == 0) {
>          return NULL;
>       }

PatchFiles:
tclCkalloc.c



This has been changed to RFE because the assumption is more of
an RFE, as we don't define it this way.  This sounds reasonable,
so we could target it for 8.3. 
-- 09/17/1999 hobbs
It was decided to add better handling for checking on the NULL
case in 8.2.1, which supports both DG-UX, AIX and similar OSes
that return NULL for malloc(0). 
-- 11/02/1999 hobbs
welch Closed ticket [218932ffff]. [History diff]2000-10-26 08:32:13
dgp Open ticket [218932ffff]. [History diff]2001-04-19 03:28:55
dgp Closed ticket [218932ffff]. [History diff]2001-04-19 03:29:19
Log in (anonymous is fine) to add a comment.