From: Matthew Fernandez Date: Thu, 15 Sep 2022 00:56:03 +0000 (-0700) Subject: sparse SparseMatrix_multiply: use cgraph wrapper for allocation X-Git-Tag: 6.0.2~35^2~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3a7a5fbc47944610bf70f613ebc40f3fdbcfb4e5;p=graphviz sparse SparseMatrix_multiply: use cgraph wrapper for allocation The lib/cgraph/alloc.h wrappers are similar to the older lib/common/memory.h wrappers except (1) they are header-only and (2) they live in a directory (cgraph) that is at the root of the dependency tree. The long term plan is to replace all use of lib/common/memory.h with lib/cgraph/alloc.h. --- diff --git a/lib/sparse/SparseMatrix.c b/lib/sparse/SparseMatrix.c index c3a7e9900..64e5dccf4 100644 --- a/lib/sparse/SparseMatrix.c +++ b/lib/sparse/SparseMatrix.c @@ -1111,7 +1111,7 @@ SparseMatrix SparseMatrix_multiply(SparseMatrix A, SparseMatrix B){ } type = A->type; - mask = MALLOC(sizeof(int)*((size_t)(B->n))); + mask = calloc((size_t)B->n, sizeof(int)); if (!mask) return NULL; for (i = 0; i < B->n; i++) mask[i] = -1;