1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

core: fix use of invalid pointer in function gui_bar_window_content_alloc (in case of insufficient memory)

This commit is contained in:
Sebastien Helleu
2014-02-22 12:57:01 +01:00
parent bcf0a94bf4
commit 47d89ce201
2 changed files with 10 additions and 4 deletions
+2
View File
@@ -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)
+8 -4
View File
@@ -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;