From 0018784cdde19444a8f970bc414796fc2a523a51 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 21 Mar 2015 17:59:13 -0700 Subject: Convert hw/dmx to new *allocarray functions Signed-off-by: Alan Coopersmith Reviewed-by: Matt Turner --- hw/dmx/dmxfont.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'hw/dmx/dmxfont.c') diff --git a/hw/dmx/dmxfont.c b/hw/dmx/dmxfont.c index 115422d41..25a04a6f0 100644 --- a/hw/dmx/dmxfont.c +++ b/hw/dmx/dmxfont.c @@ -72,7 +72,7 @@ dmxGetFontPath(int *npaths) newfp = malloc(*npaths + len); c = (unsigned char *) newfp; - fp = malloc(*npaths * sizeof(*fp)); + fp = xallocarray(*npaths, sizeof(*fp)); memmove(newfp, paths + 1, *npaths + len - 1); l = *paths; @@ -306,7 +306,7 @@ dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont) if (!dmxFontPath) dmxLog(dmxWarning, "No default font path is set.\n"); - goodfps = malloc(npaths * sizeof(*goodfps)); + goodfps = xallocarray(npaths, sizeof(*goodfps)); dmxLog(dmxError, "The DMX server failed to set the following font paths on " @@ -354,7 +354,7 @@ dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont) return FALSE; } - newfp = malloc(len * sizeof(*newfp)); + newfp = xallocarray(len, sizeof(*newfp)); for (i = 0; i < npaths; i++) { if (goodfps[i]) { int n = strlen(fp[i]); -- cgit v1.2.3