From: Matthew Fernandez Date: Sat, 7 Nov 2020 16:37:45 +0000 (-0800) Subject: replace a malloc array allocation with calloc X-Git-Tag: 2.46.0~15^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=efd4e11a91b398e780be66a92a7fee699a971fcf;p=graphviz replace a malloc array allocation with calloc This can be more efficient for large allocations and is generally cleaner code. --- diff --git a/lib/pathplan/triang.c b/lib/pathplan/triang.c index cb7811cd7..7159f35d8 100644 --- a/lib/pathplan/triang.c +++ b/lib/pathplan/triang.c @@ -62,7 +62,7 @@ int Ptriangulate(Ppoly_t * polygon, void (*fn) (void *, Ppoint_t *), pointn = polygon->pn; - pointp = malloc(pointn * sizeof(Ppoint_t *)); + pointp = calloc(pointn, sizeof(Ppoint_t *)); for (i = 0; i < pointn; i++) pointp[i] = &(polygon->ps[i]);