summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-04-25 19:55:01 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-04-26 21:21:48 +0200
commit7438d2c737b5288e5976537b3161fc966f394aa4 (patch)
tree8ca7da10c05b9e29749c7a047a73ed9d4b623df3 /src
parented48819b77fedbe962e634403e85c3c72bb4c3ca (diff)
downloadweechat-7438d2c737b5288e5976537b3161fc966f394aa4.zip
alias: remove check of NULL pointers before calling alias_free() (issue #865)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/alias/alias-config.c6
-rw-r--r--src/plugins/alias/alias.c3
2 files changed, 3 insertions, 6 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)