Ticket Hash: | 8a022f72e780f5515f30868a8a981fbbe5ff66d6 | |||
Title: | valgrind warning itkArchBase.c | |||
Status: | Closed | Type: | Code_Defect | |
Severity: | Minor | Priority: | Immediate | |
Subsystem: | Resolution: | Fixed | ||
Last Modified: | 2015-05-01 16:43:23 | |||
Version Found In: | 4.0.1 | |||
User Comments: | ||||
ralfixx added on 2015-04-18 13:42:18:
valgrind complains about a wrong memory access in Itk_ArchCompAddCmd() in itkArchBase.c #515 if (objPtr != objv[3]) { Tcl_DecrRefCount(objPtr); } The code earlier in #256 ensures that objc is either 3 or 4, and allocates objptr in #500 by checking objc if (objc != 4) { objPtr = Tcl_NewStringObj("usual", -1); Tcl_IncrRefCount(objPtr); } else { objPtr = objv[3]; } So if objc is 3, one should not access objv[3] since it is random memory. Worst thing to happen here is a small memory leak, but nevertheless it should be fixed. --- itk4.0.1/generic/itkArchBase.c~ 2015-02-05 13:45:12 +0000 +++ itk4.0.1/generic/itkArchBase.c 2015-04-18 13:29:38 +0000 @@ -512,7 +512,7 @@ Itcl_PopCallFrame(interp); } - if (objPtr != objv[3]) { + if (objc != 4) { Tcl_DecrRefCount(objPtr); } if (result != TCL_OK) { Diff finished. Sat Apr 18 15:40:57 2015 R' dgp added on 2015-05-01 16:43:23: right on the money. thanks. |