summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-04-25 19:53:32 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-04-26 21:18:24 +0200
commited48819b77fedbe962e634403e85c3c72bb4c3ca (patch)
tree8b55fce2a7ae11f31cc332d8aa970b1a9bdd941a /src
parent2c300424b474cd4e428388cc30ca40638104ff5b (diff)
downloadweechat-ed48819b77fedbe962e634403e85c3c72bb4c3ca.zip
core: remove check of NULL pointers before calling gui_focus_free_info() (issue #865)
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui-cursor.c3
-rw-r--r--src/gui/gui-focus.c3
-rw-r--r--src/gui/gui-key.c6
3 files changed, 6 insertions, 6 deletions
diff --git a/src/gui/gui-cursor.c b/src/gui/gui-cursor.c
index bc8f387d0..11f79093b 100644
--- a/src/gui/gui-cursor.c
+++ b/src/gui/gui-cursor.c
@@ -378,8 +378,7 @@ gui_cursor_move_area_add_xy (int add_x, int add_y)
}
gui_focus_free_info (focus_info_old);
- if (focus_info_new)
- gui_focus_free_info (focus_info_new);
+ gui_focus_free_info (focus_info_new);
}
/*
diff --git a/src/gui/gui-focus.c b/src/gui/gui-focus.c
index f61cf61fd..50ed3a704 100644
--- a/src/gui/gui-focus.c
+++ b/src/gui/gui-focus.c
@@ -100,6 +100,9 @@ gui_focus_get_info (int x, int y)
void
gui_focus_free_info (struct t_gui_focus_info *focus_info)
{
+ if (!focus_info)
+ return;
+
free (focus_info->chat_word);
free (focus_info->chat_focused_line);
free (focus_info->chat_focused_line_bol);
diff --git a/src/gui/gui-key.c b/src/gui/gui-key.c
index ab776f2c5..3e5a552fa 100644
--- a/src/gui/gui-key.c
+++ b/src/gui/gui-key.c
@@ -2243,10 +2243,8 @@ gui_key_focus (const char *key, int context)
rc = gui_key_focus_command (key, context, hashtable_focus);
end:
- if (focus_info1)
- gui_focus_free_info (focus_info1);
- if (focus_info2)
- gui_focus_free_info (focus_info2);
+ gui_focus_free_info (focus_info1);
+ gui_focus_free_info (focus_info2);
hashtable_free (hashtable_focus[0]);
hashtable_free (hashtable_focus[1]);