sdl12-compat: windows: if we overrode "windib" envvar, set it back.

From b73b4e98484b110c5d4780a6f31e5d0e0962d47a Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Tue, 7 Dec 2021 23:44:02 -0500
Subject: [PATCH] windows: if we overrode "windib" envvar, set it back.

Removed allocation here, too, because we don't need it.
---
 src/SDL12_compat.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index adbe2d1..8a0e9e7 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -1818,13 +1818,10 @@ SDL_InitSubSystem(Uint32 sdl12flags)
 #ifdef __WINDOWS__
     /* DOSBox (and probably other things), try to force the "windib" video
        backend, but it doesn't exist in SDL2. Force to "windows" instead. */
-    char *origenv = NULL;
+    char *origvidenv = NULL;
     const char *env = SDL20_getenv("SDL_VIDEODRIVER");
     if (env && (SDL20_strcmp(env, "windib") == 0)) {
-        origenv = SDL20_strdup(env);
-        if (origenv == NULL) {
-            return SDL20_OutOfMemory();
-        }
+        origvidenv = "windib";
         SDL20_setenv("SDL_VIDEODRIVER", "windows", 1);
     }
 #endif
@@ -1857,7 +1854,9 @@ SDL_InitSubSystem(Uint32 sdl12flags)
     }
 
 #ifdef __WINDOWS__
-    SDL20_free(origenv);
+    if (origvidenv) {  /* set this back to minimize surprise state changes. */
+        SDL20_setenv("SDL_VIDEODRIVER", origvidenv, 1);
+    }
 #endif
 
     return rc;