summaryrefslogtreecommitdiffstats
path: root/generic/tkImgGIF.c
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2019-02-01 18:27:23 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2019-02-01 18:27:23 (GMT)
commit4ea25ded4fb5e2bcfea51ab015097a9c3faa4b84 (patch)
treed55d3a87f2794e9fc0c167619e881e6072e0e46d /generic/tkImgGIF.c
parent1898d612bd82c5d1fcfd88610c71f98b09b78005 (diff)
downloadtk-4ea25ded4fb5e2bcfea51ab015097a9c3faa4b84.zip
tk-4ea25ded4fb5e2bcfea51ab015097a9c3faa4b84.tar.gz
tk-4ea25ded4fb5e2bcfea51ab015097a9c3faa4b84.tar.bz2
Correct metadata ref counting to be cleared in the error case.
Diffstat (limited to 'generic/tkImgGIF.c')
-rw-r--r--generic/tkImgGIF.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
index 480d52b..5c29622 100644
--- a/generic/tkImgGIF.c
+++ b/generic/tkImgGIF.c
@@ -512,9 +512,12 @@ FileReadGIF(
/*
* Initialize the metadata dict
+ * Start with a ref count of 1 to delete it in the error case with
+ * Tcl_DecrRefCount().
*/
metadata = Tcl_NewDictObj();
-
+ Tcl_IncrRefCount(metadata);
+
/*
* Search for the frame from the GIF to display.
*/
@@ -780,7 +783,7 @@ FileReadGIF(
* free the metadata object in case of error.
* Otherwise, it is not freed as the ref count was incremented above.
*/
- Tcl_IncrRefCount(metadata);
+ Tcl_DecrRefCount(metadata);
return result;
}