From 2e26c511c4c57306c1ac5ed380c00e0769e24b9d Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Thu, 27 Dec 2018 20:56:05 +0000 Subject: [PATCH] Fix allocation with 0 size Thanks to the static analyzer Signed-off-by: Yuxuan Shui --- src/dbus.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/dbus.c b/src/dbus.c index 96bfefd..8652b49 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -488,6 +488,11 @@ cdbus_apdarg_wids(session_t *ps, DBusMessage *msg, const void *data) { ++count; } + if (!count) { + // Nothing to append + return true; + } + // Allocate memory for an array of window IDs auto arr = ccalloc(count, cdbus_window_t);