diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-06-11 10:26:19 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-06-11 10:27:47 -0700 |
commit | 178b95c486a1abcf2395157600dc1a2da7e67441 (patch) | |
tree | 6313208d7a1eca89f42952150b9431ab97b2bf12 | |
parent | d965a1a8ce9331d2aaf1c697a29455ad55171b36 (diff) | |
download | xorg-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.c | 3 | ||||
-rw-r--r-- | src/XShape.c | 5 | ||||
-rw-r--r-- | src/Xdbe.c | 3 |
3 files changed, 7 insertions, 4 deletions
@@ -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; @@ -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; |