diff --git a/src/syncterm/syncterm.c b/src/syncterm/syncterm.c
index b8f1507412ed8c27246e653a1ad444bb87108016..a775b4527e51c7b8f8e28952db42d1e04b498d65 100644
--- a/src/syncterm/syncterm.c
+++ b/src/syncterm/syncterm.c
@@ -20,6 +20,7 @@
 #include "syncterm.h"
 #include "bbslist.h"
 #include "conn.h"
+#include "st_crypt.h"
 #include "term.h"
 #include "uifcinit.h"
 #include "window.h"
@@ -415,6 +416,9 @@ int main(int argc, char **argv)
 	else
 		FULLPATH(path,inpath,sizeof(path));
 	atexit(uifcbail);
+#ifdef USE_CRYPTLIB
+	atexit(exit_crypt);
+#endif
 
 	scrollback_buf=malloc(80*2*settings.backlines);	/* Terminal width is *always* 80 cols */
 	if(scrollback_buf==NULL) {