summaryrefslogtreecommitdiff
path: root/src/util/fontnames.c
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/util/fontnames.c
parentf54470dab5b392380df61a22b4b4bef685b6cee2 (diff)
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/util/fontnames.c')
-rw-r--r--src/util/fontnames.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/fontnames.c b/src/util/fontnames.c
index 4460728..43eafc2 100644
--- a/src/util/fontnames.c
+++ b/src/util/fontnames.c
@@ -65,8 +65,8 @@ xfont2_make_font_names_record(unsigned size)
pFN->size = size;
if (size)
{
- pFN->length = malloc(size * sizeof(int));
- pFN->names = malloc(size * sizeof(char *));
+ pFN->length = mallocarray(size, sizeof(int));
+ pFN->names = mallocarray(size, sizeof(char *));
if (!pFN->length || !pFN->names) {
free(pFN->length);
free(pFN->names);