Merge pull request #4621 from alexanderkyte/strdup_env
[mono.git] / mono / mini / aot-runtime.c
index 8cd1999b0857569f330efbad6c882ebc5bd68533..9279967b31afbe1f14bc3e47ee00a9625c7be3c5 100644 (file)
@@ -2356,8 +2356,11 @@ mono_aot_init (void)
 #endif
        mono_counters_register ("Async JIT info size", MONO_COUNTER_INT|MONO_COUNTER_JIT, &async_jit_info_size);
 
-       if (g_getenv ("MONO_LASTAOT"))
-               mono_last_aot_method = atoi (g_getenv ("MONO_LASTAOT"));
+       char *lastaot = g_getenv ("MONO_LASTAOT");
+       if (lastaot) {
+               mono_last_aot_method = atoi (lastaot);
+               g_free (lastaot);
+       }
        aot_cache_init ();
 }