about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsh8281.kim <sh8281.kim@samsung.com>2013-11-08 15:44:36 +0900
committersh8281.kim <sh8281.kim@samsung.com>2013-11-08 15:44:36 +0900
commit09257df055ca0ca14c3c71b21d82cfa48c34c97f (patch)
tree07a86e4daefdade1d4825427b79289df74848937
parentd26776a7755abf2227ba7a75f657c561999ed497 (diff)
downloadrust-09257df055ca0ca14c3c71b21d82cfa48c34c97f.tar.gz
rust-09257df055ca0ca14c3c71b21d82cfa48c34c97f.zip
fix android timegm
-rw-r--r--src/rt/rust_builtin.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index e8141d37ff1..387948613e1 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -43,12 +43,15 @@ timegm(struct tm *tm)
     char *tz;
 
     tz = getenv("TZ");
+    if (tz)
+        tz = strdup(tz);
     setenv("TZ", "", 1);
     tzset();
     ret = mktime(tm);
-    if (tz)
+    if (tz) {
         setenv("TZ", tz, 1);
-    else
+        free(tz);
+    } else
         unsetenv("TZ");
     tzset();
     return ret;