mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(cid/352839): USE_AFTER_FREE in create_user_command #18669
This commit is contained in:
parent
7f6d2984a8
commit
47d9a393de
@ -1616,7 +1616,7 @@ void create_user_command(String name, Object command, Dict(user_command) *opts,
|
|||||||
if (uc_add_command(name.data, name.size, rep, argt, def, flags, compl, compl_arg, compl_luaref,
|
if (uc_add_command(name.data, name.size, rep, argt, def, flags, compl, compl_arg, compl_luaref,
|
||||||
addr_type_arg, luaref, force) != OK) {
|
addr_type_arg, luaref, force) != OK) {
|
||||||
api_set_error(err, kErrorTypeException, "Failed to create user command");
|
api_set_error(err, kErrorTypeException, "Failed to create user command");
|
||||||
goto err;
|
// Do not goto err, since uc_add_command now owns luaref, compl_luaref, and compl_arg
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -5528,6 +5528,11 @@ char *uc_validate_name(char *name)
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Create a new user command {name}, if one doesn't already exist.
|
||||||
|
///
|
||||||
|
/// This function takes ownership of compl_arg, compl_luaref, and luaref.
|
||||||
|
///
|
||||||
|
/// @return OK if the command is created, FAIL otherwise.
|
||||||
int uc_add_command(char *name, size_t name_len, char *rep, uint32_t argt, long def, int flags,
|
int uc_add_command(char *name, size_t name_len, char *rep, uint32_t argt, long def, int flags,
|
||||||
int compl, char *compl_arg, LuaRef compl_luaref, cmd_addr_T addr_type,
|
int compl, char *compl_arg, LuaRef compl_luaref, cmd_addr_T addr_type,
|
||||||
LuaRef luaref, bool force)
|
LuaRef luaref, bool force)
|
||||||
|
Loading…
Reference in New Issue
Block a user