diff --git a/os-win32.c b/os-win32.c
index 8ad5fa1..e6e9143 100644
--- a/os-win32.c
+++ b/os-win32.c
@@ -44,6 +44,7 @@ int setenv(const char *name, const char *value, int
overwrite)
         char *string = g_malloc(length);
         snprintf(string, length, "%s=%s", name, value);
         result = putenv(string);
+        g_free(string);
     }
     return result;
