From c6fe4b18ef50bf2d4f35b12ed858e40bf65dcafa Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 13 Jul 2013 07:31:51 +0200 Subject: [PATCH] core: fix malloc(0) when building content of a bar using a filling with columns --- src/gui/gui-bar-window.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/gui-bar-window.c b/src/gui/gui-bar-window.c index 38526a206..001eacab5 100644 --- a/src/gui/gui-bar-window.c +++ b/src/gui/gui-bar-window.c @@ -838,7 +838,8 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window, /* build array with pointers to split items */ - linear_items = malloc (total_items * sizeof (*linear_items)); + linear_items = (total_items > 0) ? + malloc (total_items * sizeof (*linear_items)) : NULL; if (linear_items) { index = 0;