]> granicus.if.org Git - vim/commitdiff
patch 8.2.4652: leaking memory if assignment fails v8.2.4652
authorBram Moolenaar <Bram@vim.org>
Thu, 31 Mar 2022 09:13:47 +0000 (10:13 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 31 Mar 2022 09:13:47 +0000 (10:13 +0100)
Problem:    Leaking memory if assignment fails.
Solution:   Clear assigned value on failure.

src/version.c
src/vim9execute.c

index fdc4ae3c56683cc3d8b9e17cba2245fa53229533..843affd3ed1d9676f58eceda4e5dc175092d0940 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4652,
 /**/
     4651,
 /**/
index 19f5bdc7628fe2051cd348a1fe2af1e6721db176..7ff2eaf09ae794210a8e1ee7aad9676226ab245b 100644 (file)
@@ -3098,6 +3098,7 @@ exec_instructions(ectx_T *ectx)
                        if (iptr->isn_type == ISN_STOREEXPORT)
                        {
                            semsg(_(e_undefined_variable_str), name);
+                           clear_tv(STACK_TV_BOT(0));
                            goto on_error;
                        }
                        store_var(name, STACK_TV_BOT(0));
@@ -3118,6 +3119,7 @@ exec_instructions(ectx_T *ectx)
                                {
                                    semsg(_(e_item_not_exported_in_script_str),
                                                                         name);
+                                   clear_tv(STACK_TV_BOT(0));
                                    goto on_error;
                                }
                            }