mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
Merge #19060 memory leaks
This commit is contained in:
commit
094086a713
@ -780,6 +780,9 @@ static void f_call(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
if (argvars[2].v_type != VAR_UNKNOWN) {
|
||||
if (argvars[2].v_type != VAR_DICT) {
|
||||
emsg(_(e_dictreq));
|
||||
if (owned) {
|
||||
func_unref(func);
|
||||
}
|
||||
return;
|
||||
}
|
||||
selfdict = argvars[2].vval.v_dict;
|
||||
|
@ -1243,10 +1243,11 @@ char *runtimepath_default(bool clean_arg)
|
||||
AFTER_SIZE + 1);
|
||||
rtp_size += compute_double_env_sep_len(config_dirs, NVIM_SIZE + 1,
|
||||
AFTER_SIZE + 1);
|
||||
char *rtp = NULL;
|
||||
if (rtp_size == 0) {
|
||||
return NULL;
|
||||
goto freeall;
|
||||
}
|
||||
char *const rtp = xmalloc(rtp_size);
|
||||
rtp = xmalloc(rtp_size);
|
||||
char *rtp_cur = rtp;
|
||||
rtp_cur = add_dir(rtp_cur, config_home, config_len, kXDGConfigHome,
|
||||
NULL, 0, NULL, 0);
|
||||
@ -1271,6 +1272,7 @@ char *runtimepath_default(bool clean_arg)
|
||||
assert((size_t)(rtp_cur - rtp) == rtp_size);
|
||||
#undef SITE_SIZE
|
||||
#undef AFTER_SIZE
|
||||
freeall:
|
||||
xfree(data_dirs);
|
||||
xfree(config_dirs);
|
||||
xfree(data_home);
|
||||
|
@ -1176,21 +1176,27 @@ static void sign_define_cmd(char_u *sign_name, char_u *cmdline)
|
||||
p = skiptowhite_esc(arg);
|
||||
if (STRNCMP(arg, "icon=", 5) == 0) {
|
||||
arg += 5;
|
||||
XFREE_CLEAR(icon);
|
||||
icon = vim_strnsave(arg, (size_t)(p - arg));
|
||||
} else if (STRNCMP(arg, "text=", 5) == 0) {
|
||||
arg += 5;
|
||||
XFREE_CLEAR(text);
|
||||
text = vim_strnsave(arg, (size_t)(p - arg));
|
||||
} else if (STRNCMP(arg, "linehl=", 7) == 0) {
|
||||
arg += 7;
|
||||
XFREE_CLEAR(linehl);
|
||||
linehl = vim_strnsave(arg, (size_t)(p - arg));
|
||||
} else if (STRNCMP(arg, "texthl=", 7) == 0) {
|
||||
arg += 7;
|
||||
XFREE_CLEAR(texthl);
|
||||
texthl = vim_strnsave(arg, (size_t)(p - arg));
|
||||
} else if (STRNCMP(arg, "culhl=", 6) == 0) {
|
||||
arg += 6;
|
||||
XFREE_CLEAR(culhl);
|
||||
culhl = vim_strnsave(arg, (size_t)(p - arg));
|
||||
} else if (STRNCMP(arg, "numhl=", 6) == 0) {
|
||||
arg += 6;
|
||||
XFREE_CLEAR(numhl);
|
||||
numhl = vim_strnsave(arg, (size_t)(p - arg));
|
||||
} else {
|
||||
semsg(_(e_invarg2), arg);
|
||||
|
@ -1,5 +1,5 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local clear, nvim, eq = helpers.clear, helpers.nvim, helpers.eq
|
||||
local clear, nvim, eq, assert_alive = helpers.clear, helpers.nvim, helpers.eq, helpers.assert_alive
|
||||
|
||||
describe('sign', function()
|
||||
before_each(clear)
|
||||
@ -21,4 +21,11 @@ describe('sign', function()
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('define {id}', function()
|
||||
it ('does not leak memory when specifying multiple times the same argument', function()
|
||||
nvim('command', 'sign define Foo culhl=Normal culhl=Normal')
|
||||
assert_alive()
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user