summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclStringObj.c2
-rwxr-xr-xwin/tclWinFile.c10
2 files changed, 9 insertions, 3 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 67e86c5..996be77 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -113,7 +113,7 @@ typedef struct String {
#define STRING_UALLOC(numChars) \
((numChars) * sizeof(Tcl_UniChar))
#define STRING_SIZE(ualloc) \
- ((unsigned) ((ualloc) \
+ ((unsigned) ((ualloc != 0) \
? (sizeof(String) - sizeof(Tcl_UniChar) + (ualloc)) \
: sizeof(String)))
#define stringCheckLimits(numChars) \
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 3655321..1536bc0 100755
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -1394,6 +1394,12 @@ NativeMatchType(
return 1;
}
+static void
+FreeLoadLibHandle(
+ ClientData clientData)
+{
+ FreeLibrary((HMODULE)clientData);
+}
/*
*----------------------------------------------------------------------
*
@@ -1445,13 +1451,13 @@ TclpGetUserHome(
GetProcAddress(handle, "NetGetDCName");
netUserGetInfoProc = (NETUSERGETINFOPROC *)
GetProcAddress(handle, "NetUserGetInfo");
- Tcl_CreateExitHandler(TclpUnloadFile, handle);
+ Tcl_CreateExitHandler(FreeLoadLibHandle, handle);
}
handle = LoadLibraryA("userenv.dll");
if (handle) {
getProfilesDirectoryProc = (GETPROFILESDIRECTORYPROC *)
GetProcAddress(handle, "GetProfilesDirectoryW");
- Tcl_CreateExitHandler(TclpUnloadFile, handle);
+ Tcl_CreateExitHandler(FreeLoadLibHandle, handle);
}
apistubs = -1;