Blame SOURCES/0017-xwayland-eglstream-Fix-calloc-malloc.patch

d05f4b
From 39df6934d5a9a132c2e87456e35094b7e81a238e Mon Sep 17 00:00:00 2001
d05f4b
From: Olivier Fourdan <ofourdan@redhat.com>
d05f4b
Date: Mon, 19 Apr 2021 14:52:38 +0200
d05f4b
Subject: [PATCH xserver 17/27] xwayland/eglstream: Fix calloc/malloc
d05f4b
MIME-Version: 1.0
d05f4b
Content-Type: text/plain; charset=UTF-8
d05f4b
Content-Transfer-Encoding: 8bit
d05f4b
d05f4b
Use calloc() instead of malloc() like the rest of the code.
d05f4b
d05f4b
Also fix the arguments of calloc() calls to match the definition which
d05f4b
is calloc(size_t nmemb, size_t size).
d05f4b
d05f4b
This is a cleanup patch, no functional change.
d05f4b
d05f4b
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
d05f4b
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
d05f4b
(cherry picked from commit a45799971083c47082d085d3732a5b12692cf75b)
d05f4b
---
d05f4b
 hw/xwayland/xwayland-glamor-eglstream.c | 4 ++--
d05f4b
 1 file changed, 2 insertions(+), 2 deletions(-)
d05f4b
d05f4b
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
d05f4b
index ce066cd9e..3a3caa976 100644
d05f4b
--- a/hw/xwayland/xwayland-glamor-eglstream.c
d05f4b
+++ b/hw/xwayland/xwayland-glamor-eglstream.c
d05f4b
@@ -562,7 +562,7 @@ xwl_eglstream_queue_pending_stream(WindowPtr window, PixmapPtr pixmap)
d05f4b
     DebugF("eglstream: win %d queues new pending stream for pixmap %p\n",
d05f4b
            window->drawable.id, pixmap);
d05f4b
 
d05f4b
-    pending_stream = malloc(sizeof(*pending_stream));
d05f4b
+    pending_stream = calloc(1, sizeof(*pending_stream));
d05f4b
     pending_stream->window = window;
d05f4b
     pending_stream->pixmap = pixmap;
d05f4b
     pending_stream->is_valid = TRUE;
d05f4b
@@ -596,7 +596,7 @@ xwl_eglstream_create_pixmap_and_stream(struct xwl_screen *xwl_screen,
d05f4b
     struct wl_array stream_attribs;
d05f4b
     int stream_fd = -1;
d05f4b
 
d05f4b
-    xwl_pixmap = calloc(sizeof(*xwl_pixmap), 1);
d05f4b
+    xwl_pixmap = calloc(1, sizeof(*xwl_pixmap));
d05f4b
     if (!xwl_pixmap)
d05f4b
         FatalError("Not enough memory to create pixmap\n");
d05f4b
     xwl_pixmap_set_private(pixmap, xwl_pixmap);
d05f4b
-- 
d05f4b
2.31.1
d05f4b