diff --git a/ChangeLog b/ChangeLog index 986e745ab..11ef4a60b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] == Version 0.4.4 (under dev) +* core: fix use of invalid pointer in function gui_bar_window_content_alloc + (in case of insufficient memory) * core: fix uninitialized value in function string_decode_base64 * core: fix memory leak and use of invalid pointer in split of string (in case of insufficient memory) diff --git a/src/gui/gui-bar-window.c b/src/gui/gui-bar-window.c index 2842ad380..e5fa41ebf 100644 --- a/src/gui/gui-bar-window.c +++ b/src/gui/gui-bar-window.c @@ -433,19 +433,23 @@ gui_bar_window_content_alloc (struct t_gui_bar_window *bar_window) bar_window->items_refresh_needed = NULL; bar_window->screen_col_size = 0; bar_window->screen_lines = 0; - bar_window->items_subcount = malloc (bar_window->items_count * + bar_window->items_subcount = calloc (1, + bar_window->items_count * sizeof (*bar_window->items_subcount)); if (!bar_window->items_subcount) goto error; - bar_window->items_content = malloc ((bar_window->items_count) * + bar_window->items_content = calloc (1, + (bar_window->items_count) * sizeof (*bar_window->items_content)); if (!bar_window->items_content) goto error; - bar_window->items_num_lines = malloc ((bar_window->items_count) * + bar_window->items_num_lines = calloc (1, + (bar_window->items_count) * sizeof (*bar_window->items_num_lines)); if (!bar_window->items_num_lines) goto error; - bar_window->items_refresh_needed = malloc (bar_window->items_count * + bar_window->items_refresh_needed = calloc (1, + bar_window->items_count * sizeof (*bar_window->items_refresh_needed)); if (!bar_window->items_refresh_needed) goto error;