1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 13:26:38 +02:00

spell: remove check of NULL pointers before calling free() (issue #865)

This commit is contained in:
Sébastien Helleu
2024-04-24 23:52:45 +02:00
parent 3973258628
commit 1f104d06a0
3 changed files with 14 additions and 29 deletions
+5 -10
View File
@@ -125,10 +125,8 @@ spell_enchant_dict_describe_cb (const char *lang_tag,
weechat_printf (NULL, " %s", str_dict);
}
if (lang)
free (lang);
if (country)
free (country);
free (lang);
free (country);
}
#endif /* USE_ENCHANT */
@@ -197,10 +195,8 @@ spell_command_speller_list_dicts ()
weechat_printf (NULL, " %s", str_dict);
if (lang)
free (lang);
if (country)
free (country);
free (lang);
free (country);
}
delete_aspell_dict_info_enumeration (elements);
@@ -437,8 +433,7 @@ spell_command_cb (const void *pointer, void *data,
dicts = weechat_string_replace (argv_eol[2], " ", "");
spell_command_set_dict (buffer,
(dicts) ? dicts : argv[2]);
if (dicts)
free (dicts);
free (dicts);
return WEECHAT_RC_OK;
}
+3 -6
View File
@@ -446,12 +446,9 @@ spell_speller_buffer_free_value_cb (struct t_hashtable *hashtable,
ptr_speller_buffer = (struct t_spell_speller_buffer *)value;
if (ptr_speller_buffer->spellers)
free (ptr_speller_buffer->spellers);
if (ptr_speller_buffer->modifier_string)
free (ptr_speller_buffer->modifier_string);
if (ptr_speller_buffer->modifier_result)
free (ptr_speller_buffer->modifier_result);
free (ptr_speller_buffer->spellers);
free (ptr_speller_buffer->modifier_string);
free (ptr_speller_buffer->modifier_result);
free (ptr_speller_buffer);
}
+6 -13
View File
@@ -216,10 +216,8 @@ spell_warning_aspell_config ()
spell_filename);
}
if (aspell_filename)
free (aspell_filename);
if (spell_filename)
free (spell_filename);
free (aspell_filename);
free (spell_filename);
}
/*
@@ -938,8 +936,7 @@ spell_modifier_cb (const void *pointer, void *data,
* the beginning of this word, save the word (we will
* look for suggestions after this loop)
*/
if (misspelled_word)
free (misspelled_word);
free (misspelled_word);
misspelled_word = strdup (ptr_string);
}
}
@@ -1021,9 +1018,7 @@ spell_modifier_cb (const void *pointer, void *data,
}
}
if (old_misspelled_word)
free (old_misspelled_word);
free (old_misspelled_word);
free (misspelled_word);
}
else
@@ -1046,8 +1041,7 @@ spell_modifier_cb (const void *pointer, void *data,
(void) weechat_hook_signal_send ("spell_suggest",
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
if (old_suggestions)
free (old_suggestions);
free (old_suggestions);
ptr_speller_buffer->modifier_result = strdup (*result);
@@ -1165,8 +1159,7 @@ spell_config_change_nick_completer_cb (const void *pointer, void *data,
(void) data;
(void) option;
if (spell_nick_completer)
free (spell_nick_completer);
free (spell_nick_completer);
spell_nick_completer = weechat_string_strip (value, 0, 1, " ");
spell_len_nick_completer =