Mercurial > vim
comparison src/vim9script.c @ 20844:1360541e8c74 v8.2.0974
patch 8.2.0974: Vim9: memory leak when script var has wrong type
Commit: https://github.com/vim/vim/commit/f3decc5830ef8d8d94902b76114935283dd4142e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 13 19:56:38 2020 +0200
patch 8.2.0974: Vim9: memory leak when script var has wrong type
Problem: Vim9: memory leak when script var has wrong type.
Solution: Free the variable name.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 13 Jun 2020 20:00:04 +0200 |
parents | bacc2ab11810 |
children | 709379ab5110 |
comparison
equal
deleted
inserted
replaced
20843:1a9f8fe67cd7 | 20844:1360541e8c74 |
---|---|
475 | 475 |
476 // parse type | 476 // parse type |
477 p = skipwhite(p + 1); | 477 p = skipwhite(p + 1); |
478 type = parse_type(&p, &si->sn_type_list); | 478 type = parse_type(&p, &si->sn_type_list); |
479 if (called_emsg != called_emsg_before) | 479 if (called_emsg != called_emsg_before) |
480 { | |
481 vim_free(name); | |
480 return p; | 482 return p; |
483 } | |
481 | 484 |
482 // Create the variable with 0/NULL value. | 485 // Create the variable with 0/NULL value. |
483 CLEAR_FIELD(init_tv); | 486 CLEAR_FIELD(init_tv); |
484 init_tv.v_type = type->tt_type; | 487 init_tv.v_type = type->tt_type; |
485 set_var_const(name, type, &init_tv, FALSE, 0); | 488 set_var_const(name, type, &init_tv, FALSE, 0); |