Overview
| Artifact ID: | 86d5c0d87b46b571e7b277a90e0467f15092060c |
|---|---|
| Ticket: | 218196ffffffffffffffffffffffffffffffffff
Tcl_DbCkrealloc craches on NULL-pointers |
| User & Date: | nobody on 2000-10-26 00:54:23 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
OriginalBugID: 2384 Bug Version: 8.2b1 SubmitDate: '1999-07-19' LastModified: '1999-07-21' Severity: SER Status: Closed Submitter: techsupp ChangedBy: redman OS: Other Machine: NA FixedDate: '2000-10-25' ClosedDate: '1999-07-21' Name: Martin Forssen ObservedBehavior: Tcl_DbCkrealloc crashes if the memory area to be realloced is NULL. DesiredBehavior: It should work as Tcl_Dballoc in this case (since that is what realloc does) Patch: *** generic/tclCkalloc.c Fri Apr 16 03:46:42 1999 --- ../tcl8.1/generic/tclCkalloc.c Fri May 7 22:27:39 1999 *************** *** 522,535 **** { char *new; unsigned int copySize; /* * See comment from Tcl_DbCkfree before you change the following * line. */ ! struct mem_header *memp = (struct mem_header *) ! (((unsigned long) ptr) - BODY_OFFSET); copySize = size; if (copySize > (unsigned int) memp->length) { --- 522,539 ---- { char *new; unsigned int copySize; + struct mem_header *memp; + + if (NULL == ptr) { + return Tcl_DbCkalloc(size, file, line); + } /* * See comment from Tcl_DbCkfree before you change the following * line. */ ! memp = (struct mem_header *) (((unsigned long) ptr) - BODY_OFFSET); copySize = size; if (copySize > (unsigned int) memp->length) { PatchFiles: generic/tclCkalloc.c Umm... why in the world would you realloc a NULL pointer? Correct behavior. -- 07/21/1999 redman - foundin changed to: "obsolete: 8.2b1"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "69. Other"
- title changed to: "Tcl_DbCkrealloc craches on NULL-pointers"
- type changed to: "Bug"