Numerical Recipes Forum  

Go Back   Numerical Recipes Forum > Numerical Recipes Official Announcements > Official Bug Reports (NR3, the Third Edition)

Reply
 
Thread Tools Display Modes
  #1  
Old 09-13-2011, 02:39 PM
Saul Teukolsky Saul Teukolsky is offline
Numerical Recipes Author
 
Join Date: Dec 2001
Posts: 210
memory leak in broydn.h

There are potential memory leaks in broydn.h: The second and third times that the statement
Code:
restrt=true;
gets executed, the routine returns to the statement
Code:
qr=new QRdcmp(fdjac(x,fvec));
without deleting the old qr. The fix is to replace
Code:
QRdcmp *qr;
with
Code:
QRdcmp *qr=NULL;
and insert
Code:
delete qr;
before the statement
Code:
qr=new QRdcmp(fdjac(x,fvec));
Note that this bug will not cause incorrect results to be calculated, but may cause your program to crash if broydn is called many times with these side branches being taken often.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:32 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.