From: John Ellson Date: Tue, 6 Jan 2015 23:39:59 +0000 (-0500) Subject: coverity #82684 X-Git-Tag: TRAVIS_CI_BUILD_EXPERIMENTAL~129^2~5^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8d7e12b00f83c008b543c5fcd8c99bf711186e95;p=graphviz coverity #82684 --- diff --git a/tclpkg/gdtclft/gdtclft.c b/tclpkg/gdtclft/gdtclft.c index 5a245afe9..4d99bcd7e 100644 --- a/tclpkg/gdtclft/gdtclft.c +++ b/tclpkg/gdtclft/gdtclft.c @@ -458,10 +458,10 @@ tclGdCreateCmd(Tcl_Interp * interp, int argc, Tcl_Obj * CONST objv[]) /* Not a channel, or Tcl_GetOpenFile() not supported. * See if we can open directly. */ - fileByName++; if ((filePtr = fopen(arg2, "rb")) == NULL) { return TCL_ERROR; } + fileByName++; Tcl_ResetResult(interp); } @@ -492,6 +492,9 @@ tclGdCreateCmd(Tcl_Interp * interp, int argc, Tcl_Obj * CONST objv[]) #endif } else { Tcl_AppendResult(interp, cmd + 10, "unrecognizable format requested", NULL); + if (fileByName) { + fclose(filePtr); + } return TCL_ERROR; } if (fileByName) {