diff options
Diffstat (limited to 'src/bitmap/bdfread.c')
-rw-r--r-- | src/bitmap/bdfread.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/bitmap/bdfread.c b/src/bitmap/bdfread.c index f2b1e22..f4340b9 100644 --- a/src/bitmap/bdfread.c +++ b/src/bitmap/bdfread.c @@ -53,6 +53,7 @@ from The Open Group. #include <config.h> #endif #include "libxfontint.h" +#include "src/util/replace.h" #include <ctype.h> #include <X11/fonts/fntfilst.h> @@ -107,7 +108,7 @@ bdfReadBitmap(CharInfoPtr pCI, FontFilePtr file, int bit, int byte, widthBytes = BYTES_PER_ROW(widthBits, glyph); if (widthBytes * height > 0) { - picture = malloc(widthBytes * height); + picture = mallocarray(widthBytes, height); if (!picture) { bdfError("Couldn't allocate picture (%d*%d)\n", widthBytes, height); goto BAILOUT; @@ -313,7 +314,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState, bitmapFont->metrics = ci; if (bitmapExtra) { - bitmapExtra->glyphNames = malloc(nchars * sizeof(Atom)); + bitmapExtra->glyphNames = mallocarray(nchars, sizeof(Atom)); if (!bitmapExtra->glyphNames) { bdfError("Couldn't allocate glyphNames (%d*%d)\n", nchars, (int) sizeof(Atom)); @@ -321,7 +322,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState, } } if (bitmapExtra) { - bitmapExtra->sWidths = malloc(nchars * sizeof(int)); + bitmapExtra->sWidths = mallocarray(nchars, sizeof(int)); if (!bitmapExtra->sWidths) { bdfError("Couldn't allocate sWidth (%d *%d)\n", nchars, (int) sizeof(int)); @@ -640,7 +641,7 @@ bdfReadProperties(FontFilePtr file, FontPtr pFont, bdfFileState *pState) pFont->info.props = NULL; pFont->info.nprops = 0; - stringProps = malloc((nProps + BDF_GENPROPS) * sizeof(char)); + stringProps = mallocarray((nProps + BDF_GENPROPS), sizeof(char)); pFont->info.isStringProp = stringProps; if (stringProps == NULL) { bdfError("Couldn't allocate stringProps (%d*%d)\n", |