Fix allocation with 0 size

Thanks to the static analyzer

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2018-12-27 20:56:05 +00:00
parent 669cbcdb14
commit 2e26c511c4
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 5 additions and 0 deletions

View File

@ -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);