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/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index c88b547..a06f733 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -3080,6 +3080,12 @@
         call prop_add(ln, 0, {'type': vt, 'text': '+', 'text_align': 'below'})
       endfor
       normal G
+
+      func AddMore()
+        call prop_add(5, 0, {'type': g:vt, 'text': '!', 'text_align': 'above'})
+        call prop_add(5, 0, {'type': g:vt, 'text': '!', 'text_align': 'above'})
+        call prop_add(5, 0, {'type': g:vt, 'text': '!', 'text_align': 'above'})
+      endfunc
   END
   call writefile(lines, 'XscriptPropAboveBelowEmpty', 'D')
   let buf = RunVimInTerminal('-S XscriptPropAboveBelowEmpty', #{rows: 16, cols: 60})
@@ -3101,6 +3107,12 @@
   call term_sendkeys(buf, "kk")
   call VerifyScreenDump(buf, 'Test_prop_above_below_empty_5', {})
 
+  " This was drawing line number over cmdline and leaking memory.
+  call term_sendkeys(buf, ":call AddMore()\<CR>")
+  call term_sendkeys(buf, "gg")
+  call term_sendkeys(buf, "j")
+  call VerifyScreenDump(buf, 'Test_prop_above_below_empty_6', {})
+
   call StopVimInTerminal(buf)
 endfunc