Mercurial > octave
changeset 24259:676bf5131971
maint: merge stable to default.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 15 Nov 2017 19:27:09 -0800 |
parents | 056c799eb0f8 (current diff) bffbc95fa72b (diff) |
children | 861e12ce7c06 |
files | libinterp/dldfcn/__delaunayn__.cc |
diffstat | 1 files changed, 16 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/dldfcn/__delaunayn__.cc Wed Nov 15 15:26:11 2017 -0800 +++ b/libinterp/dldfcn/__delaunayn__.cc Wed Nov 15 19:27:09 2017 -0800 @@ -72,6 +72,19 @@ std::fclose (f); } +static void +free_qhull_memory () +{ + qh_freeqhull (! qh_ALL); + + int curlong, totlong; + qh_memfreeshort (&curlong, &totlong); + + if (curlong || totlong) + warning ("__delaunay__: did not free %d bytes of long memory (%d pieces)", + totlong, curlong); +} + static bool octave_qhull_dims_ok (octave_idx_type dim, octave_idx_type n, const char *who) { @@ -167,6 +180,9 @@ int exitcode = qh_new_qhull (dim, n, pt_array, ismalloc, flags, outfile, errfile); + + frame.add_fcn (free_qhull_memory); + if (exitcode) error ("__delaunayn__: qhull failed"); @@ -208,16 +224,6 @@ retval(0) = simpl; } - - // Free memory from Qhull - qh_freeqhull (! qh_ALL); - - int curlong, totlong; - qh_memfreeshort (&curlong, &totlong); - - if (curlong || totlong) - warning ("__delaunay__: did not free %d bytes of long memory (%d pieces)", - totlong, curlong); } else if (n == dim + 1) {