Tcl Source Code

Check-in [d66fb2fbf9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Undo change [c39553c370]. Not needed, in head the TclFreeIntRep macro does the right thing.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | mistake
Files: files | file ages | folders
SHA1: d66fb2fbf96e4c9caa683bea27535482595842bd
User & Date: andreask 2011-04-20 18:14:23
Original Comment: Undo change [c39553c370]. Not needed, in head the TclFreeIntRep macro does the right thing.
Context
2011-04-20
18:14
Undo change [c39553c370]. Not needed, in head the TclFreeIntRep macro does the right thing. Closed-Leaf check-in: d66fb2fbf9 user: andreask tags: mistake
17:52
(TclFileAttrsCmd): Added commands to reset the typePtr of the Tcl_Obj* whose int-rep was just purged... check-in: c39553c370 user: andreask tags: mistake
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.

1



2
3
4
5
6
7
8
2011-04-20  Andreas Kupries  <[email protected]>




	* generic/tclFCmd.c (TclFileAttrsCmd): Added commands to reset the
	typePtr of the Tcl_Obj* whose int-rep was just purged. Required to
	prevent a dangling IndexRep* to reused, smashing the heap. See
	also the entries at 2011-04-16 and 2011-03-24 for the history of
	the problem.


>
>
>







1
2
3
4
5
6
7
8
9
10
11
2011-04-20  Andreas Kupries  <[email protected]>

	* Undo change below. Not needed, in head the TclFreeIntRep macro
	does the right thing.

	* generic/tclFCmd.c (TclFileAttrsCmd): Added commands to reset the
	typePtr of the Tcl_Obj* whose int-rep was just purged. Required to
	prevent a dangling IndexRep* to reused, smashing the heap. See
	also the entries at 2011-04-16 and 2011-03-24 for the history of
	the problem.

Changes to generic/tclFCmd.c.

1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092

	if (Tcl_GetIndexFromObj(interp, objv[0], attributeStrings,
		"option", 0, &index) != TCL_OK) {
	    goto end;
	}
	if (attributeStringsAllocated != NULL) {
	    TclFreeIntRep(objv[0]);
	    objv[0]->typePtr = NULL;
	}
	if (Tcl_FSFileAttrsGet(interp, index, filePtr,
		&objPtr) != TCL_OK) {
	    goto end;
	}
	Tcl_SetObjResult(interp, objPtr);
    } else {







<







1078
1079
1080
1081
1082
1083
1084

1085
1086
1087
1088
1089
1090
1091

	if (Tcl_GetIndexFromObj(interp, objv[0], attributeStrings,
		"option", 0, &index) != TCL_OK) {
	    goto end;
	}
	if (attributeStringsAllocated != NULL) {
	    TclFreeIntRep(objv[0]);

	}
	if (Tcl_FSFileAttrsGet(interp, index, filePtr,
		&objPtr) != TCL_OK) {
	    goto end;
	}
	Tcl_SetObjResult(interp, objPtr);
    } else {
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
	for (i = 0; i < objc ; i += 2) {
	    if (Tcl_GetIndexFromObj(interp, objv[i], attributeStrings,
		    "option", 0, &index) != TCL_OK) {
		goto end;
	    }
	    if (attributeStringsAllocated != NULL) {
		TclFreeIntRep(objv[i]);
		objv[i]->typePtr = NULL;
	    }
	    if (i + 1 == objc) {
		Tcl_AppendResult(interp, "value for \"",
			TclGetString(objv[i]), "\" missing", NULL);
		Tcl_SetErrorCode(interp, "TCL", "OPERATION", "FATTR",
			"NOVALUE", NULL);
		goto end;







<







1106
1107
1108
1109
1110
1111
1112

1113
1114
1115
1116
1117
1118
1119
	for (i = 0; i < objc ; i += 2) {
	    if (Tcl_GetIndexFromObj(interp, objv[i], attributeStrings,
		    "option", 0, &index) != TCL_OK) {
		goto end;
	    }
	    if (attributeStringsAllocated != NULL) {
		TclFreeIntRep(objv[i]);

	    }
	    if (i + 1 == objc) {
		Tcl_AppendResult(interp, "value for \"",
			TclGetString(objv[i]), "\" missing", NULL);
		Tcl_SetErrorCode(interp, "TCL", "OPERATION", "FATTR",
			"NOVALUE", NULL);
		goto end;