Subject: Followup to [6325d5dbeac6f91d28d6]. dlerror() may return NULL. Fixed the code which wasn't prepared to deal with that.

From: andreask <andreask>
Date: Mon, 27 Aug 2012 17:12:06 +0000

---
 unix/tclLoadDl.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c
index f8fe6d3..a48aa23 100644
--- a/unix/tclLoadDl.c
+++ b/unix/tclLoadDl.c
@@ -176,8 +176,14 @@ FindSymbol(
     }
     Tcl_DStringFree(&ds);
     if (proc == NULL && interp != NULL) {
+	const char *errorStr = dlerror();
+
+	if (!errorStr) {
+	    errorStr = "unknown";
+	}
+
 	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
-		"cannot find symbol \"%s\": %s", symbol, dlerror()));
+		"cannot find symbol \"%s\": %s", symbol, errorStr));
 	Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LOAD_SYMBOL", symbol,
 		NULL);
     }
-- 
cgit v0.12