diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/fit.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -5332,7 +5332,7 @@ int fit_event(event *ev, double *xopt, double *fmin, int id, double maxtime) if (time_elapsed > maxtime) goto end; - if (stop) goto end; + if (stop) goto stop; do { *fmin = fval; @@ -5346,7 +5346,7 @@ int fit_event(event *ev, double *xopt, double *fmin, int id, double maxtime) time_elapsed += tv_stop.tv_sec - tv_start.tv_sec + (tv_stop.tv_usec - tv_start.tv_usec)/1e6; - if (stop) goto end; + if (stop) goto stop; } while (fval < *fmin && fabs(fval-*fmin) > 1e-2 && time_elapsed < maxtime); if (fval < *fmin) { @@ -5354,11 +5354,13 @@ int fit_event(event *ev, double *xopt, double *fmin, int id, double maxtime) memcpy(xopt,x,sizeof(x)); } +end: + nlopt_destroy(opt); return 0; -end: +stop: nlopt_destroy(opt); return NLOPT_FORCED_STOP; |