updated for version 7.1-161
diff --git a/src/edit.c b/src/edit.c
index c16dadd..f2fe692 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -2236,7 +2236,7 @@
 	    while (i < actual_len && (p - IObuff + 6) < IOSIZE)
 #ifdef FEAT_MBYTE
 		if (has_mbyte)
-		    p += mb_char2bytes(wca[i++], p);
+		    p += (*mb_char2bytes)(wca[i++], p);
 		else
 #endif
 		    *(p++) = wca[i++];
@@ -6444,8 +6444,10 @@
 {
     vim_free(last_insert);
     last_insert = NULL;
+# ifdef FEAT_INS_EXPAND
     vim_free(compl_orig_text);
     compl_orig_text = NULL;
+# endif
 }
 #endif
 
diff --git a/src/misc2.c b/src/misc2.c
index f22bf3f..7f39723 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -964,7 +964,6 @@
 {
     buf_T	*buf, *nextbuf;
     static int	entered = FALSE;
-    win_T	*win;
 
     /* When we cause a crash here it is caught and Vim tries to exit cleanly.
      * Don't try freeing everything again. */
@@ -972,15 +971,17 @@
 	return;
     entered = TRUE;
 
+# ifdef FEAT_AUTOCMD
     block_autocmds();	    /* don't want to trigger autocommands here */
+# endif
 
-#ifdef FEAT_WINDOWS
+# ifdef FEAT_WINDOWS
     /* close all tabs and windows */
     if (first_tabpage->tp_next != NULL)
 	do_cmdline_cmd((char_u *)"tabonly!");
     if (firstwin != lastwin)
 	do_cmdline_cmd((char_u *)"only!");
-#endif
+# endif
 
 # if defined(FEAT_SPELL)
     /* Free all spell info. */
@@ -1031,8 +1032,12 @@
     free_regexp_stuff();
     free_tag_stuff();
     free_cd_dir();
+# ifdef FEAT_EVAL
     set_expr_line(NULL);
+# endif
+# ifdef FEAT_DIFF
     diff_clear(curtab);
+# endif
     clear_sb_text();	      /* free any scrollback text */
 
     /* Free some global vars. */
@@ -1041,19 +1046,27 @@
     vim_free(clip_exclude_prog);
 # endif
     vim_free(last_cmdline);
+# ifdef FEAT_CMDHIST
     vim_free(new_last_cmdline);
+# endif
     set_keep_msg(NULL, 0);
     vim_free(ff_expand_buffer);
 
     /* Clear cmdline history. */
     p_hi = 0;
+# ifdef FEAT_CMDHIST
     init_history();
+# endif
 
 #ifdef FEAT_QUICKFIX
-    qf_free_all(NULL);
-    /* Free all location lists */
-    FOR_ALL_WINDOWS(win)
-	qf_free_all(win);
+    {
+	win_T	*win;
+
+	qf_free_all(NULL);
+	/* Free all location lists */
+	FOR_ALL_WINDOWS(win)
+	    qf_free_all(win);
+    }
 #endif
 
     /* Close all script inputs. */
diff --git a/src/version.c b/src/version.c
index c4595c7..846eb45 100644
--- a/src/version.c
+++ b/src/version.c
@@ -667,6 +667,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    161,
+/**/
     160,
 /**/
     159,