Fix allocation with 0 size
Thanks to the static analyzer Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
669cbcdb14
commit
2e26c511c4
|
@ -488,6 +488,11 @@ cdbus_apdarg_wids(session_t *ps, DBusMessage *msg, const void *data) {
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!count) {
|
||||||
|
// Nothing to append
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Allocate memory for an array of window IDs
|
// Allocate memory for an array of window IDs
|
||||||
auto arr = ccalloc(count, cdbus_window_t);
|
auto arr = ccalloc(count, cdbus_window_t);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue