#4961: sage/modules/vector_modn_sparse_c.pxi: allocate_c_vector_modint can leak
memory in case of failure
----------------------+-----------------------------------------------------
 Reporter:  mabshoff  |       Owner:  craigcitro
     Type:  defect    |      Status:  new       
 Priority:  major     |   Milestone:  sage-3.3  
Component:  memleak   |    Keywords:            
----------------------+-----------------------------------------------------
 Look at
 {{{
 cdef int allocate_c_vector_modint(c_vector_modint* v, Py_ssize_t
 num_nonzero) except -1:
     """
     Allocate memory for a c_vector_modint -- most user code won't call
 this.
     """
     v.entries = <int*>sage_malloc(num_nonzero*sizeof(int))
     if v.entries == NULL:
         raise MemoryError, "Error allocating memory"
     v.positions = <Py_ssize_t*>sage_malloc(num_nonzero*sizeof(Py_ssize_t))
     if v.positions == NULL:
         raise MemoryError, "Error allocating memory"
     return 0
 }}}

 When the allocation for positions fails we will leak entries.

 Cheers,

 Michael

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4961>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to