diff options
-rw-r--r-- | src/plugins/alias/alias-config.c | 6 | ||||
-rw-r--r-- | src/plugins/alias/alias.c | 3 | ||||
-rw-r--r-- | tests/unit/plugins/alias/test-alias.cpp | 3 |
3 files changed, 5 insertions, 7 deletions
diff --git a/src/plugins/alias/alias-config.c b/src/plugins/alias/alias-config.c index 9d8162b65..d9c9a5dc1 100644 --- a/src/plugins/alias/alias-config.c +++ b/src/plugins/alias/alias-config.c @@ -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; diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c index d74c77d7a..49ec65320 100644 --- a/src/plugins/alias/alias.c +++ b/src/plugins/alias/alias.c @@ -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) diff --git a/tests/unit/plugins/alias/test-alias.cpp b/tests/unit/plugins/alias/test-alias.cpp index b98214085..aaf7cea06 100644 --- a/tests/unit/plugins/alias/test-alias.cpp +++ b/tests/unit/plugins/alias/test-alias.cpp @@ -228,7 +228,8 @@ TEST(Alias, Rename) TEST(Alias, Free) { - /* TODO: write tests */ + /* test free of NULL alias */ + alias_free (NULL); } /* |