patch 9.1.0189: Memory leak with "above" virttext and 'relativenumber'
Problem: Memory leak with "above" virtual text and 'relativenumber'.
Solution: Free "text_props" and "text_prop_idxs" before returning.
Also fix off-by-one error causing line number to be drawn
beyond end of window (zeertzjq).
fixes: #14239
closes: #14241
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/drawline.c b/src/drawline.c
index ed02f3c..a8de449 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -1683,8 +1683,12 @@
{
// skip over rows only used for virtual text above
wlv.row += wlv.text_prop_above_count;
- if (wlv.row > endrow)
+ if (wlv.row >= endrow)
+ {
+ vim_free(text_props);
+ vim_free(text_prop_idxs);
return wlv.row;
+ }
wlv.screen_row += wlv.text_prop_above_count;
}
#endif