diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-11-03 12:57:15 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-11-03 12:57:15 (GMT) |
| commit | 5528e1c1a25f45988be72e2e16ff577f0dbb1abd (patch) | |
| tree | 26ba5be3c875f141162b3833302bf0b1075f50f6 | |
| parent | 274ab123a800239134ffb7e63421a13f55b38b89 (diff) | |
| download | tcl-5528e1c1a25f45988be72e2e16ff577f0dbb1abd.zip tcl-5528e1c1a25f45988be72e2e16ff577f0dbb1abd.tar.gz tcl-5528e1c1a25f45988be72e2e16ff577f0dbb1abd.tar.bz2 | |
Fix [6f2f83cc149e9918884faffefebc8dfa695f4ea0|6f2f83cc14]: tclWinload.c robustness. And fix a minor possible memory leak in TclSetupEnv() as well. Thanks to Christian Werner for both suggestions, backported from Androwish.
| -rw-r--r-- | generic/tclEnv.c | 1 | ||||
| -rw-r--r-- | win/tclWinLoad.c | 10 |
2 files changed, 8 insertions, 3 deletions
diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 66ddb57..8cc4b74 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -130,6 +130,7 @@ TclSetupEnv( * '='; ignore the entry. */ + Tcl_DStringFree(&envString); continue; } p2++; diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c index 3ad6328..2946ea2 100644 --- a/win/tclWinLoad.c +++ b/win/tclWinLoad.c @@ -63,7 +63,7 @@ TclpDlopen( * file. */ int flags) { - HINSTANCE hInstance; + HINSTANCE hInstance = NULL; const TCHAR *nativeName; Tcl_LoadHandle handlePtr; DWORD firstError; @@ -75,7 +75,10 @@ TclpDlopen( */ nativeName = Tcl_FSGetNativePath(pathPtr); - hInstance = LoadLibraryEx(nativeName,NULL,LOAD_WITH_ALTERED_SEARCH_PATH); + if (nativeName != NULL) { + hInstance = LoadLibraryEx(nativeName, NULL, + LOAD_WITH_ALTERED_SEARCH_PATH); + } if (hInstance == NULL) { /* * Let the OS loader examine the binary search path for whatever @@ -89,7 +92,8 @@ TclpDlopen( * Remember the first error on load attempt to be used if the * second load attempt below also fails. */ - firstError = GetLastError(); + firstError = (nativeName == NULL) ? + ERROR_MOD_NOT_FOUND : GetLastError(); nativeName = Tcl_WinUtfToTChar(Tcl_GetString(pathPtr), -1, &ds); hInstance = LoadLibraryEx(nativeName, NULL, |
