Tk Source Code

Check-in [fbbe3b6e]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:Correct metadata ref counting to be cleared in the error case.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tip-529-image-metadata
Files: files | file ages | folders
SHA3-256: fbbe3b6e8ac38598e497f194e14bfea4b8890a322fb57c7382b61fe9809491d1
User & Date: oehhar 2019-02-01 18:27:23
Context
2019-03-05
15:43
merge trunk Leaf check-in: a493f488 user: oehhar tags: tip-529-image-metadata
2019-02-01
18:27
Correct metadata ref counting to be cleared in the error case. check-in: fbbe3b6e user: oehhar tags: tip-529-image-metadata
18:15
Fix a bug also present in standard Tk: Trailing segments of image data are not skipped, final 0 byte is not skipped, -index over 1 should not work IMHO. check-in: 0101cd3f user: oehhar tags: tip-529-image-metadata
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkImgGIF.c.

508
509
510
511
512
513
514


515
516

517
518
519
520
521
522
523
524
...
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
     * -------------------------------------------------------------------------
     * From here on, go to error to not leave memory leaks
     * -------------------------------------------------------------------------
     */

    /*
     * Initialize the metadata dict


     */
    metadata = Tcl_NewDictObj();

    
    /*
     * Search for the frame from the GIF to display.
     */

    while (1) {
	if (-1 == (gifLabel = ReadOneByte( interp, gifConfPtr, chan ) ) ) {
	    goto error;
................................................................................
	ckfree(trashBuffer);
    }
    
    /*
     * free the metadata object in case of error.
     * Otherwise, it is not freed as the ref count was incremented above.
     */
    Tcl_IncrRefCount(metadata);
    return result;
}
 

/*
 *----------------------------------------------------------------------
 *






>
>


>
|







 







|







508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
...
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
     * -------------------------------------------------------------------------
     * From here on, go to error to not leave memory leaks
     * -------------------------------------------------------------------------
     */

    /*
     * 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.
     */

    while (1) {
	if (-1 == (gifLabel = ReadOneByte( interp, gifConfPtr, chan ) ) ) {
	    goto error;
................................................................................
	ckfree(trashBuffer);
    }
    
    /*
     * free the metadata object in case of error.
     * Otherwise, it is not freed as the ref count was incremented above.
     */
    Tcl_DecrRefCount(metadata);
    return result;
}
 

/*
 *----------------------------------------------------------------------
 *