1
0
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:
Sébastien Helleu
2024-04-25 19:55:01 +02:00
parent ed48819b77
commit 7438d2c737
3 changed files with 5 additions and 7 deletions
+2 -4
View File
@@ -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;
+1 -2
View File
@@ -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)
+2 -1
View File
@@ -228,7 +228,8 @@ TEST(Alias, Rename)
TEST(Alias, Free)
{
/* TODO: write tests */
/* test free of NULL alias */
alias_free (NULL);
}
/*