From 85aac3aef7c9fa70dc07467858439a6d6f533ac0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 5 Oct 2018 19:37:38 +0000 Subject: Fix wrong usage of Tcl_WinTCharToUtf() contract: nativePath should never be NULL, but actually it can be. --- win/tclWinFCmd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index 52ea8c6..2f28154 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -1026,7 +1026,8 @@ DoRemoveJustDirectory( if (nativePath == NULL || nativePath[0] == '\0') { Tcl_SetErrno(ENOENT); - goto end; + Tcl_DStringInit(errorPtr); + return TCL_ERROR; } attr = GetFileAttributes(nativePath); @@ -1108,9 +1109,7 @@ DoRemoveJustDirectory( end: if (errorPtr != NULL) { - char *p; - Tcl_WinTCharToUtf(nativePath, -1, errorPtr); - p = Tcl_DStringValue(errorPtr); + char *p = Tcl_WinTCharToUtf(nativePath, -1, errorPtr); for (; *p; ++p) { if (*p == '\\') *p = '/'; } -- cgit v0.12