changeset 30883:7ad8385ff106 stable

pass correct length to SparseRep idx_type_deallocate function * Sparse.cc (Sparse<T>::resize): Pass length of m_rep->m_ncols+1 instead of m_rep->m_ncols to idx_type_deallocate function for m_rep->m_cidx deallocation.
author John W. Eaton <jwe@octave.org>
date Fri, 01 Apr 2022 07:25:50 -0400
parents 2ec4bc7593cc
children 0a1aec50a0c8
files liboctave/array/Sparse.cc
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/array/Sparse.cc	Tue Mar 29 16:49:26 2022 -0400
+++ b/liboctave/array/Sparse.cc	Fri Apr 01 07:25:50 2022 -0400
@@ -1023,7 +1023,7 @@
     {
       octave_idx_type *new_cidx = m_rep->idx_type_allocate (c+1);
       std::copy_n (m_rep->m_cidx, std::min (c, m_rep->m_ncols) + 1, new_cidx);
-      m_rep->idx_type_deallocate (m_rep->m_cidx, m_rep->m_ncols);
+      m_rep->idx_type_deallocate (m_rep->m_cidx, m_rep->m_ncols + 1);
       m_rep->m_cidx = new_cidx;
 
       if (c > m_rep->m_ncols)