From 9d58e4a665c5055e65bc70a3f95eebae7f700845 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 30 Mar 2026 12:06:04 -0700 Subject: [PATCH] [PR #2194] present: prevent memory leaks in present_create_notifies() PR: https://github.com/X11Libre/xserver/pull/2194 --- present/present_notify.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/present/present_notify.c b/present/present_notify.c index fe84d1f07..84592765f 100644 --- a/present/present_notify.c +++ b/present/present_notify.c @@ -78,6 +78,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;