Tcl_SetResult(interp, sp, (Tcl_FreeProc *)free);
tcl_result = Tcl_NewStringObj(sp, -1); Tcl_SetObjResult(interp, tcl_result); free(sp);
int MktempCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]){	char *template, *sp;	if (objc != 2) {		Tcl_WrongNumArgs(interp, 1, objv, "template");		return TCL_ERROR;	}	template = strdup(Tcl_GetString(objv[1]));	if (template == NULL)		return TCL_ERROR;	if ((sp = mktemp(template)) == NULL) {		Tcl_AppendResult(interp, "mktemp failed: ", strerror(errno), NULL);		free(template);		return TCL_ERROR;	}	Tcl_SetResult(interp, sp, (Tcl_FreeProc *)free);	return TCL_OK;}