summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-06-11 10:26:19 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-06-11 10:27:47 -0700
commit178b95c486a1abcf2395157600dc1a2da7e67441 (patch)
tree6313208d7a1eca89f42952150b9431ab97b2bf12
parentd965a1a8ce9331d2aaf1c697a29455ad55171b36 (diff)
downloadxorg-lib-libXext-178b95c486a1abcf2395157600dc1a2da7e67441.tar.gz
Convert calls to Xmalloc arrays to use Xmallocarray instead
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/XEVI.c3
-rw-r--r--src/XShape.c5
-rw-r--r--src/Xdbe.c3
3 files changed, 7 insertions, 4 deletions
diff --git a/src/XEVI.c b/src/XEVI.c
index 4a7918a..31a5eff 100644
--- a/src/XEVI.c
+++ b/src/XEVI.c
@@ -31,6 +31,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/extutil.h>
#include <X11/Xutil.h>
#include <limits.h>
+#include "reallocarray.h"
static XExtensionInfo *xevi_info;/* needs to move to globals.c */
static const char *xevi_extension_name = EVINAME;
@@ -146,7 +147,7 @@ Status XeviGetVisualInfo(
return BadValue;
}
}
- temp_visual = Xmalloc(sz_VisualID32 * n_visual);
+ temp_visual = Xmallocarray(n_visual, sz_VisualID32);
for (visualIndex = 0; visualIndex < n_visual; visualIndex++)
temp_visual[visualIndex] = visual[visualIndex];
}
diff --git a/src/XShape.c b/src/XShape.c
index 15d754f..c51e5b9 100644
--- a/src/XShape.c
+++ b/src/XShape.c
@@ -36,6 +36,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/extensions/shape.h>
#include <X11/extensions/shapeproto.h>
#include <limits.h>
+#include "reallocarray.h"
static XExtensionInfo _shape_info_data;
static XExtensionInfo *shape_info = &_shape_info_data;
@@ -463,8 +464,8 @@ XRectangle *XShapeGetRectangles (
rects = NULL;
if (rep.nrects) {
if (rep.nrects < (INT_MAX / sizeof (XRectangle))) {
- xrects = Xmalloc (rep.nrects * sizeof (xRectangle));
- rects = Xmalloc (rep.nrects * sizeof (XRectangle));
+ xrects = Xmallocarray (rep.nrects, sizeof (xRectangle));
+ rects = Xmallocarray (rep.nrects, sizeof (XRectangle));
} else {
xrects = NULL;
rects = NULL;
diff --git a/src/Xdbe.c b/src/Xdbe.c
index 514f078..f662d59 100644
--- a/src/Xdbe.c
+++ b/src/Xdbe.c
@@ -40,6 +40,7 @@
#include <X11/extensions/Xdbe.h>
#include <X11/extensions/dbeproto.h>
#include <limits.h>
+#include "reallocarray.h"
static XExtensionInfo _dbe_info_data;
static XExtensionInfo *dbe_info = &_dbe_info_data;
@@ -367,7 +368,7 @@ XdbeScreenVisualInfo *XdbeGetVisualInfo (
if (c < 65536) {
scrVisInfo[i].count = c;
- scrVisInfo[i].visinfo = Xmalloc(c * sizeof(XdbeVisualInfo));
+ scrVisInfo[i].visinfo = Xmallocarray(c, sizeof(XdbeVisualInfo));
} else
scrVisInfo[i].visinfo = NULL;