]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0243: memory leak in change_indent() v9.2.0243
authorHuihui Huang <625173@qq.com>
Wed, 25 Mar 2026 19:18:20 +0000 (19:18 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 25 Mar 2026 19:18:20 +0000 (19:18 +0000)
Problem:  memory leak in change_indent()
Solution: Free orig_line in the error case
          (Huihui Huang)

closes: #19820

Signed-off-by: Huihui Huang <625173@qq.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/indent.c
src/version.c

index e31da232aa4391f75793110c1c35f311564c9b42..26f60701c27644709e933d62ecc13d5acaba45f7 100644 (file)
@@ -1513,7 +1513,10 @@ change_indent(
        // Save new line
        new_line = vim_strnsave(ml_get_curline(), ml_get_curline_len());
        if (new_line == NULL)
+       {
+           vim_free(orig_line);
            return;
+       }
 
        // We only put back the new line up to the cursor
        new_line[curwin->w_cursor.col] = NUL;
index 003ddcacb3b12c61557b82fc86454ed6f429d096..75ff30ec92b94010be23707e2a2238d653c436a7 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    243,
 /**/
     242,
 /**/