diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-24 23:14:26 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-25 20:59:24 +0200 |
commit | f92606a31750ef81dcef976bdf223b823699da4e (patch) | |
tree | b58df12e03ee9d9f5717555125c3f5aa759904c7 /src/plugins/charset/charset.c | |
parent | c3750a02e380c7b270f94cf515a9ddfea97f0ad6 (diff) | |
download | weechat-f92606a31750ef81dcef976bdf223b823699da4e.zip |
charset: remove check of NULL pointers before calling free() (issue #865)
Diffstat (limited to 'src/plugins/charset/charset.c')
-rw-r--r-- | src/plugins/charset/charset.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/plugins/charset/charset.c b/src/plugins/charset/charset.c index ce87d5301..790356e46 100644 --- a/src/plugins/charset/charset.c +++ b/src/plugins/charset/charset.c @@ -542,8 +542,7 @@ charset_command_cb (const void *pointer, void *data, _("%s%s: wrong charset type (decode or encode " "expected)"), weechat_prefix ("error"), CHARSET_PLUGIN_NAME); - if (option_name) - free (option_name); + free (option_name); return WEECHAT_RC_OK; } } @@ -556,8 +555,7 @@ charset_command_cb (const void *pointer, void *data, _("%s%s: invalid charset: \"%s\""), weechat_prefix ("error"), CHARSET_PLUGIN_NAME, ptr_charset); - if (option_name) - free (option_name); + free (option_name); return WEECHAT_RC_OK; } if (ptr_section) @@ -641,16 +639,11 @@ weechat_plugin_end (struct t_weechat_plugin *plugin) weechat_config_free (charset_config_file); charset_config_file = NULL; - if (charset_terminal) - { - free (charset_terminal); - charset_terminal = NULL; - } - if (charset_internal) - { - free (charset_internal); - charset_internal = NULL; - } + free (charset_terminal); + charset_terminal = NULL; + + free (charset_internal); + charset_internal = NULL; return WEECHAT_RC_OK; } |