summaryrefslogtreecommitdiff
path: root/src/QuColors.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/QuColors.c')
-rw-r--r--src/QuColors.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/QuColors.c b/src/QuColors.c
index 0b9bc508..10cf1825 100644
--- a/src/QuColors.c
+++ b/src/QuColors.c
@@ -28,6 +28,7 @@ in this Software without prior written authorization from The Open Group.
#include <config.h>
#endif
#include "Xlibint.h"
+#include "reallocarray.h"
static void
_XQueryColors(
@@ -50,9 +51,9 @@ _XQueryColors(
/* XXX this isn't very efficient */
if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) {
- unsigned long nbytes = (long) ncolors * SIZEOF(xrgb);
- xrgb *color = Xmalloc(nbytes);
+ xrgb *color = Xmallocarray(ncolors, sizeof(xrgb));
if (color != NULL) {
+ unsigned long nbytes = (long) ncolors * SIZEOF(xrgb);
_XRead(dpy, (char *) color, nbytes);