diff --git a/present/present_notify.c b/present/present_notify.c index 00b3b68bd..fdd15463b 100644 --- a/present/present_notify.c +++ b/present/present_notify.c @@ -76,6 +76,13 @@ present_create_notifies(ClientPtr client, int num_notifies, xPresentNotify *x_no int added = 0; int status; + if (num_notifies <= 0) { + if (num_notifies == 0) + return Success; + else + return BadLength; + } + notifies = calloc (num_notifies, sizeof (present_notify_rec)); if (!notifies) return BadAlloc;