summaryrefslogtreecommitdiff
path: root/src/FreeType
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2019-08-03 19:29:05 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2019-08-04 11:23:20 -0700
commitddbee30d3525cdd66b84056affc407601680cc29 (patch)
treeae251a90a3e4cd3420d361edba93a4ea3656babc /src/FreeType
parentf54470dab5b392380df61a22b4b4bef685b6cee2 (diff)
downloadxorg-lib-libXfont-ddbee30d3525cdd66b84056affc407601680cc29.tar.gz
Convert multiplying malloc calls to use mallocarray instead
Introduces mallocarray as a macro calling reallocarray with a NULL pointer for the old allocation. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src/FreeType')
-rw-r--r--src/FreeType/ftfuncs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c
index f86d8dd..e98f920 100644
--- a/src/FreeType/ftfuncs.c
+++ b/src/FreeType/ftfuncs.c
@@ -637,7 +637,7 @@ FreeTypeInstanceFindGlyph(unsigned idx_in, int flags, FTInstancePtr instance,
}
if((*glyphs)[segment] == NULL) {
- (*glyphs)[segment] = malloc(sizeof(CharInfoRec) * FONTSEGMENTSIZE);
+ (*glyphs)[segment] = mallocarray(sizeof(CharInfoRec), FONTSEGMENTSIZE);
if((*glyphs)[segment] == NULL)
return AllocError;
}
@@ -1623,7 +1623,7 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
( (font_properties && (post || t1info)) ? 3 : 0 ) +
2; /* type */
- info->props = malloc(maxprops * sizeof(FontPropRec));
+ info->props = mallocarray(maxprops, sizeof(FontPropRec));
if(info->props == NULL)
return AllocError;
@@ -2816,7 +2816,7 @@ FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face,
font->nranges = vals->nranges;
font->ranges = 0;
if(font->nranges) {
- font->ranges = malloc(vals->nranges*sizeof(fsRange));
+ font->ranges = mallocarray(vals->nranges, sizeof(fsRange));
if(font->ranges == NULL)
return AllocError;
memcpy((char*)font->ranges, (char*)vals->ranges,