Problem: Asan detects a memory error when EXITFREE is defined. (Dominique
Pelle)
Solution: In getvcol() check for ml_get_buf() returning an empty string.
Also skip adjusting the scroll position. Set "exiting" in
mch_exit() for all systems.
posptr = NULL; /* continue until the NUL */
else
{
+ /* Special check for an empty line, which can happen on exit, when
+ * ml_get_buf() always returns an empty string. */
+ if (*ptr == NUL)
+ pos->col = 0;
posptr = ptr + pos->col;
#ifdef FEAT_MBYTE
if (has_mbyte)
void
mch_exit(int r)
{
+ exiting = TRUE;
+
if (raw_in) /* put terminal in 'normal' mode */
{
settmode(TMODE_COOK);
void
mch_exit(int r)
{
+ exiting = TRUE;
+
display_errors();
ml_close_all(TRUE); /* remove all memfiles */
void
mch_exit(int r)
{
- stoptermcap();
+ exiting = TRUE;
+ stoptermcap();
if (g_fWindInitCalled)
settmode(TMODE_COOK);
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 307,
/**/
306,
/**/
wp->w_height = height;
wp->w_skipcol = 0;
- scroll_to_fraction(wp, prev_height);
+ /* There is no point in adjusting the scroll position when exiting. Some
+ * values might be invalid. */
+ if (!exiting)
+ scroll_to_fraction(wp, prev_height);
}
void