From 869891f9c87b326ddef4de461b92de98ec647b82 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 25 Dec 2021 12:10:38 -0800 Subject: [PATCH] mingle genBundleColors: avoid some manual memory management --- cmd/mingle/minglemain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/mingle/minglemain.cpp b/cmd/mingle/minglemain.cpp index 6983d98c8..12caf5779 100644 --- a/cmd/mingle/minglemain.cpp +++ b/cmd/mingle/minglemain.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -295,7 +296,7 @@ static void genBundleColors(pedge edge, std::ostream &os, double maxwgt) { double len, t, len_total0 = 0; int dim = edge->dim; double* x = edge->x; - double* lens = (double*)MALLOC(sizeof(double) * edge->npoints); + std::unique_ptr lens(new double[edge->npoints]); for (j = 0; j < edge->npoints - 1; j++){ len = 0; @@ -317,7 +318,6 @@ static void genBundleColors(pedge edge, std::ostream &os, double maxwgt) { } } os << std::dec << std::setw(0); // reset stream characteristics - free (lens); } static void -- 2.40.0