mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-03-31 04:10:41 +02: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>
This commit is contained in:
parent
16ca2c7a11
commit
201563a544
1 changed files with 7 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue