Mercurial > octave
changeset 27940:ec0690a6955c stable rc-5-1-90
Lock amd and symbfact to avoid segmentation fault with SuiteSparse (bug #57435).
* dldfcn/amd.cc (Famd), dldfcn/symbfact.cc (Fsymbfact): Use DEFMETHOD_DLD. Call
"mlock" to avoid having invalid function pointers in global SuiteSparse_config
structure when the functions are unloaded (e.g. with "clear functions").
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sun, 22 Dec 2019 01:01:27 +0100 |
parents | 56dd7419d7aa |
children | d9e325dbd5d3 058ff501c92d |
files | libinterp/dldfcn/amd.cc libinterp/dldfcn/symbfact.cc |
diffstat | 2 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/dldfcn/amd.cc Tue Dec 24 04:01:33 2019 +0100 +++ b/libinterp/dldfcn/amd.cc Sun Dec 22 01:01:27 2019 +0100 @@ -41,9 +41,10 @@ #include "oct-map.h" #include "ov.h" #include "ovl.h" +#include "parse.h" -DEFUN_DLD (amd, args, nargout, - doc: /* -*- texinfo -*- +DEFMETHOD_DLD (amd, interp, args, nargout, + doc: /* -*- texinfo -*- @deftypefn {} {@var{p} =} amd (@var{S}) @deftypefnx {} {@var{p} =} amd (@var{S}, @var{opts}) @@ -143,6 +144,9 @@ Matrix xinfo (AMD_INFO, 1); double *Info = xinfo.fortran_vec (); + // Lock the function to not loose the SuiteSparse_config structure + interp.mlock (); + // FIXME: how can we manage the memory allocation of amd // in a cleaner manner? SUITESPARSE_ASSIGN_FPTR (malloc_func, amd_malloc, malloc);
--- a/libinterp/dldfcn/symbfact.cc Tue Dec 24 04:01:33 2019 +0100 +++ b/libinterp/dldfcn/symbfact.cc Sun Dec 22 01:01:27 2019 +0100 @@ -43,10 +43,11 @@ #include "error.h" #include "errwarn.h" #include "ovl.h" +#include "parse.h" #include "utils.h" -DEFUN_DLD (symbfact, args, nargout, - doc: /* -*- texinfo -*- +DEFMETHOD_DLD (symbfact, interp, args, nargout, + doc: /* -*- texinfo -*- @deftypefn {} {[@var{count}, @var{h}, @var{parent}, @var{post}, @var{R}] =} symbfact (@var{S}) @deftypefnx {} {[@dots{}] =} symbfact (@var{S}, @var{typ}) @deftypefnx {} {[@dots{}] =} symbfact (@var{S}, @var{typ}, @var{mode}) @@ -209,6 +210,9 @@ cholmod_common *cm = &Common; CHOLMOD_NAME(start) (cm); + // Lock the function to not loose the SuiteSparse_config structure + interp.mlock (); + double spu = octave_sparse_params::get_key ("spumoni"); if (spu == 0.0) {