mirror of
https://github.com/weechat/weechat.git
synced 2026-07-03 00:03:12 +02:00
alias: remove check of NULL pointers before calling alias_free() (issue #865)
This commit is contained in:
@@ -113,8 +113,7 @@ alias_config_cmd_delete_cb (const void *pointer, void *data,
|
||||
weechat_config_option_get_pointer (option, "name"));
|
||||
|
||||
ptr_alias = alias_search (weechat_config_option_get_pointer (option, "name"));
|
||||
if (ptr_alias)
|
||||
alias_free (ptr_alias);
|
||||
alias_free (ptr_alias);
|
||||
|
||||
weechat_config_option_free (ptr_option_completion);
|
||||
}
|
||||
@@ -249,8 +248,7 @@ alias_config_cmd_create_option_cb (const void *pointer, void *data,
|
||||
|
||||
/* create alias */
|
||||
ptr_alias = alias_search (option_name);
|
||||
if (ptr_alias)
|
||||
alias_free (ptr_alias);
|
||||
alias_free (ptr_alias);
|
||||
if (value && value[0])
|
||||
rc = (alias_new (option_name, value, NULL)) ?
|
||||
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
|
||||
|
||||
@@ -696,8 +696,7 @@ alias_new (const char *name, const char *command, const char *completion)
|
||||
}
|
||||
|
||||
ptr_alias = alias_search (name);
|
||||
if (ptr_alias)
|
||||
alias_free (ptr_alias);
|
||||
alias_free (ptr_alias);
|
||||
|
||||
new_alias = malloc (sizeof (*new_alias));
|
||||
if (new_alias)
|
||||
|
||||
@@ -228,7 +228,8 @@ TEST(Alias, Rename)
|
||||
|
||||
TEST(Alias, Free)
|
||||
{
|
||||
/* TODO: write tests */
|
||||
/* test free of NULL alias */
|
||||
alias_free (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user