summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--generic/tkImgGIF.c3
-rw-r--r--generic/tkImgPPM.c4
-rw-r--r--generic/tkImgPhoto.c6
-rw-r--r--generic/tkMenu.c7
5 files changed, 25 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 793970a..15353a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2001-09-14 Andreas Kupries <andreas_kupries@users.sourceforge.net>
+
+ * generic/tkImgGIF.c:
+ * generic/tkImgPPM.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkMenu.c: Applied patch [461578], provided by Vincent
+ Darley. This fixes several memory leaks in the image code. They
+ happen if there are errors during the initialization of the
+ channel the image is supposed to be read from.
+
2001-09-12 Mo DeJong <mdejong@users.sourceforge.net>
* unix/configure:
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
index 54c857e..108c7ad 100644
--- a/generic/tkImgGIF.c
+++ b/generic/tkImgGIF.c
@@ -29,7 +29,7 @@
* | provided "as is" without express or implied warranty. |
* +-------------------------------------------------------------------+
*
- * RCS: @(#) $Id: tkImgGIF.c,v 1.17 2001/07/03 06:00:45 hobbs Exp $
+ * RCS: @(#) $Id: tkImgGIF.c,v 1.18 2001/09/14 20:35:58 andreas_kupries Exp $
*/
/*
@@ -1354,6 +1354,7 @@ FileWriteGIF (interp, filename, format, blockPtr)
return TCL_ERROR;
}
if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") != TCL_OK) {
+ Tcl_Close(NULL, chan);
return TCL_ERROR;
}
diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c
index 49aba5a..98c790b 100644
--- a/generic/tkImgPPM.c
+++ b/generic/tkImgPPM.c
@@ -13,7 +13,7 @@
* Department of Computer Science,
* Australian National University.
*
- * RCS: @(#) $Id: tkImgPPM.c,v 1.7 1999/12/21 23:55:11 hobbs Exp $
+ * RCS: @(#) $Id: tkImgPPM.c,v 1.8 2001/09/14 20:35:58 andreas_kupries Exp $
*/
#define USE_OLD_IMAGE
@@ -274,10 +274,12 @@ FileWritePPM(interp, fileName, formatString, blockPtr)
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;
}
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 2423ebe..2a9d1df 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -15,7 +15,7 @@
* Department of Computer Science,
* Australian National University.
*
- * RCS: @(#) $Id: tkImgPhoto.c,v 1.23 2001/04/03 04:34:20 hobbs Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.24 2001/09/14 20:35:58 andreas_kupries Exp $
*/
#include "tkInt.h"
@@ -1093,10 +1093,12 @@ ImgPhotoCmd(clientData, interp, objc, objv)
}
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 @@ ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, flags)
}
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,
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index a4cc86c..84e338d 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMenu.c,v 1.11 2001/08/01 16:21:11 dgp Exp $
+ * RCS: @(#) $Id: tkMenu.c,v 1.12 2001/09/14 20:35:58 andreas_kupries Exp $
*/
/*
@@ -2718,7 +2718,10 @@ CloneMenu(menuPtr, newMenuNamePtr, newMenuTypePtr)
== 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;