shithub: mc

Download patch

ref: 555658791708fca90cbe2f8fd1bc1ce2a6a1b3ab
parent: fe0bcf756016bd8cad54c1af77f054b94fc8d11b
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Jan 26 11:38:00 EST 2016

Don't duplicate TMPDIR.

    Env vars are not malloced.

--- a/lib/std/mktemp.myr
+++ b/lib/std/mktemp.myr
@@ -24,7 +24,7 @@
 
 	match std.getenv("TMPDIR")
 	| `std.Some d:	tmpdir = d
-	| `std.None:	tmpdir = std.sldup("/tmp")
+	| `std.None:	tmpdir = "/tmp"
 	;;
 
 	for var i = 0; i < Retries; i++
@@ -33,16 +33,13 @@
 		| `Fail e:
 			if e != Eexist
 				std.slfree(path)
-				std.slfree(tmpdir)
 				-> `Fail e
 			;;
 		| `Ok fd:
-			std.slfree(tmpdir)
 			-> `Ok (fd, path)
 		;;
 		std.slfree(path)
 	;;
-	std.slfree(tmpdir)
 	-> `Fail Eexist
 }