aboutsummaryrefslogtreecommitdiff
path: root/jim-file.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2014-04-23 10:05:43 +1000
committerSteve Bennett <steveb@workware.net.au>2014-04-23 14:35:44 +1000
commita92eb84a32df63d31e9741bff83a8809f14afd4e (patch)
tree9c5d06a325d8f895825f255aa4ef2ce970fceba2 /jim-file.c
parent8cb7e5a255b03251840263eda4b0b8904dd39db3 (diff)
downloadjimtcl-a92eb84a32df63d31e9741bff83a8809f14afd4e.zip
jimtcl-a92eb84a32df63d31e9741bff83a8809f14afd4e.tar.gz
jimtcl-a92eb84a32df63d31e9741bff83a8809f14afd4e.tar.bz2
file: avoid mem leak on mkstemp failure
Courtesy of coverity Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim-file.c')
-rw-r--r--jim-file.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/jim-file.c b/jim-file.c
index c700ea2..ddb0ede 100644
--- a/jim-file.c
+++ b/jim-file.c
@@ -498,6 +498,7 @@ static int file_cmd_tempfile(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
fd = mkstemp(filename);
if (fd < 0) {
Jim_SetResultString(interp, "Failed to create tempfile", -1);
+ Jim_Free(filename);
return JIM_ERR;
}
close(fd);