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

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