Get rid of the variable 'advapi' in Pageant's WinMain, which was never
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 24 Jul 2013 19:18:06 +0000 (19:18 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 24 Jul 2013 19:18:06 +0000 (19:18 +0000)
actually used for anything sensible and could have been freed while
containing nonsense at program end.

git-svn-id: svn://svn.tartarus.org/sgt/putty@9971 cda61777-01e9-0310-a592-d414129be87e

windows/winpgnt.c

index 1f6484f..6791160 100644 (file)
@@ -2039,7 +2039,6 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
 {
     WNDCLASS wndclass;
     MSG msg;
-    HMODULE advapi;
     char *command = NULL;
     int added_keys = 0;
     int argc, i;
@@ -2080,8 +2079,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
                   "Pageant Fatal Error", MB_ICONERROR | MB_OK);
        return 1;
 #endif
-    } else
-       advapi = NULL;
+    }
 
     /*
      * See if we can find our Help file.
@@ -2134,8 +2132,6 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
     for (i = 0; i < argc; i++) {
        if (!strcmp(argv[i], "-pgpfp")) {
            pgp_fingerprints();
-           if (advapi)
-               FreeLibrary(advapi);
            return 1;
        } else if (!strcmp(argv[i], "-c")) {
            /*
@@ -2185,8 +2181,6 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
            MessageBox(NULL, "Pageant is already running", "Pageant Error",
                       MB_ICONERROR | MB_OK);
        }
-       if (advapi)
-           FreeLibrary(advapi);
        return 0;
     }
 
@@ -2266,9 +2260,6 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
 
     if (keypath) filereq_free(keypath);
 
-    if (advapi)
-       FreeLibrary(advapi);
-
     cleanup_exit(msg.wParam);
     return msg.wParam;                /* just in case optimiser complains */
 }