[OS-tickets] [Optimization Services] #49: Dangling pointer in OSnl2osil

Optimization Services coin-trac at coin-or.org
Thu Dec 29 07:35:19 EST 2011


#49: Dangling pointer in OSnl2osil
--------------------+-------------------------------------------------------
 Reporter:  walter  |        Type:  defect       
   Status:  new     |    Priority:  minor        
Milestone:          |   Component:  other/unknown
  Version:          |    Keywords:               
--------------------+-------------------------------------------------------
 In OSnl2osil's constructor has the following:
 {{{
 stub = &nlfilename[ 0];
 nl = jac0dim(stub, (fint)strlen(stub));
 }}}
 Where nlfilename is passed by value and so it will be destroyed on exit
 from the c'tor (leaving stub dangling.)[[BR]]
 One solution is to remove the unused member and simplify the c'tor to:
 {{{
 nl = jac0dim(nlfilename.c_str(), (fint)nlfilename.length());
 }}}

-- 
Ticket URL: <https://projects.coin-or.org/OS/ticket/49>
Optimization Services <http://projects.coin-or.org/OS>
An interface for Web services implementing optimization.



More information about the OS-tickets mailing list