mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
present: prevent memory leaks in present_create_notifies()
Reported in #1817: xwayland-24.1.6/redhat-linux-build/../present/present_notify.c:83:17: warning[-Wanalyzer-malloc-leak]: leak of ‘notifies’ xwayland-24.1.6/redhat-linux-build/../present/present_notify.c:83:17: branch_false: following ‘false’ branch (when ‘i >= num_notifies’)... Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2164>
This commit is contained in:
committed by
Enrico Weigelt, metux IT consult
parent
29f39cf072
commit
cbe66c79bf
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user