patch 8.2.0399: various memory leaks

Problem:    Various memory leaks.
Solution:   Avoid the leaks. (Ozaki Kiichi, closes #5803)
diff --git a/src/scriptfile.c b/src/scriptfile.c
index 9c644e2..838d5f6 100644
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -1133,7 +1133,8 @@
     {
 	// Already loaded and no need to load again, return here.
 	*ret_sid = sid;
-	return OK;
+	retval = OK;
+	goto theend;
     }
 #endif