Tk Source Code

Artifact [c1791fd7]
Login

Artifact c1791fd79472512312ceb8250a2c62074e35bd0b:

Attachment "tkLeaks.diff" to ticket [461578ff] added by vincentdarley 2001-09-14 23:11:44.
Index: tkImgGIF.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkImgGIF.c,v
retrieving revision 1.17
diff -u -r1.17 tkImgGIF.c
--- tkImgGIF.c	2001/07/03 06:00:45	1.17
+++ tkImgGIF.c	2001/09/14 16:09:07
@@ -1354,6 +1354,7 @@
 	return TCL_ERROR;
     }
     if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") != TCL_OK) {
+	Tcl_Close(NULL, chan);
 	return TCL_ERROR;
     }
 
Index: tkImgPPM.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkImgPPM.c,v
retrieving revision 1.7
diff -u -r1.7 tkImgPPM.c
--- tkImgPPM.c	1999/12/21 23:55:11	1.7
+++ tkImgPPM.c	2001/09/14 16:09:07
@@ -274,10 +274,12 @@
 
     if (Tcl_SetChannelOption(interp, chan, "-translation", "binary")
 	    != TCL_OK) {
+	Tcl_Close(NULL, chan);
 	return TCL_ERROR;
     }
     if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary")
 	    != TCL_OK) {
+	Tcl_Close(NULL, chan);
 	return TCL_ERROR;
     }
     
Index: tkImgPhoto.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkImgPhoto.c,v
retrieving revision 1.23
diff -u -r1.23 tkImgPhoto.c
--- tkImgPhoto.c	2001/04/03 04:34:20	1.23
+++ tkImgPhoto.c	2001/09/14 16:09:08
@@ -1093,10 +1093,12 @@
 	}
         if (Tcl_SetChannelOption(interp, chan, "-translation", "binary")
 		!= TCL_OK) {
+	    Tcl_Close(NULL, chan);
             return TCL_ERROR;
         }
         if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary")
 		!= TCL_OK) {
+	    Tcl_Close(NULL, chan);
             return TCL_ERROR;
         }
     
@@ -1710,10 +1712,12 @@
 	}
         if (Tcl_SetChannelOption(interp, chan, "-translation", "binary")
 		!= TCL_OK) {
+	    Tcl_Close(NULL, chan);
             return TCL_ERROR;
         }
         if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary")
 		!= TCL_OK) {
+	    Tcl_Close(NULL, chan);
             return TCL_ERROR;
         }
 	if (MatchFileFormat(interp, chan, masterPtr->fileString,
Index: tkMenu.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/generic/tkMenu.c,v
retrieving revision 1.11
diff -u -r1.11 tkMenu.c
--- tkMenu.c	2001/08/01 16:21:11	1.11
+++ tkMenu.c	2001/09/14 16:09:08
@@ -2718,7 +2718,10 @@
    	    		== 0) {
    	    	    Tcl_Obj *newElementPtr = Tcl_NewStringObj(
    	    	    	    Tk_PathName(newMenuPtr->masterMenuPtr->tkwin), -1);
-		    Tcl_IncrRefCount(newElementPtr);
+		    /* 
+		     * The newElementPtr will have its refCount incremented
+		     * here, so we don't need to worry about it any more.
+		     */
    	    	    Tcl_ListObjReplace(menuPtr->interp, bindingsPtr,
    	    	    	    i + 1, 0, 1, &newElementPtr);
 		    newObjv[2] = bindingsPtr;