@@ -337,6 +337,7 @@ static inline INT gridsearch(const UINT D,
337337 M = oversampling_factor * deg ;
338338 ret_code = poly_roots_fftgridsearch (deg , transfer_matrix + (deg + 1 ), & M ,
339339 PHI , roots );
340+ CHECK_RETCODE (ret_code , release_mem );
340341
341342 // Coordinate transform (from discrete-time to continuous-time domain)
342343 for (i = 0 ; i < M ; i ++ )
@@ -476,6 +477,7 @@ static inline INT subsample_and_refine(const UINT D,
476477 // Refine the remaining roots
477478 ret_code = refine_mainspec (D , q , eps_t , K , roots ,
478479 opts_ptr -> max_evals , +2.0 , kappa );
480+ CHECK_RETCODE (ret_code , release_mem );
479481
480482 // Filter the refined roots
481483 if (opts_ptr -> filtering != fnft_nsep_filt_NONE ) {
@@ -574,7 +576,8 @@ static inline INT subsample_and_refine(const UINT D,
574576 // Refine the roots
575577 ret_code = refine_auxspec (D , q , eps_t , M , roots ,
576578 opts_ptr -> max_evals , kappa );
577-
579+ CHECK_RETCODE (ret_code , release_mem );
580+
578581 // Filter the refined roots
579582 if (opts_ptr -> filtering != fnft_nsep_filt_NONE ) {
580583 ret_code = misc_filter (& M , roots , NULL , opts_ptr -> bounding_box );
0 commit comments