mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 17:36:29 +00:00
fix(coverity/348300): free memory when overiding sing attribute
Nothing prevent the user from doing `:sign define abc culhl=Normal culhl=Normal` and thus this leads to an obvious memory leak.
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user