gsl_sum_levin_u_workspace*gsl_sum_levin_u_alloc(size_tn){gsl_sum_levin_u_workspace*w;w=(gsl_sum_levin_u_workspace*)malloc(sizeof(gsl_sum_levin_u_workspace));w->q_num=(double*)malloc(n*sizeof(double));if(w->q_num==NULL){free(w);/*constructorerror,preventmemoryleak*/GSL_ERROR_VAL("failed to allocate space for q_num",GSL_ENOMEM,0);}w->q_den=(double*)malloc(n*sizeof(double));if(w->q_den==NULL){free(w->q_num);free(w);/*constructorerror,preventmemoryleak*/GSL_ERROR_VAL("failed to allocate space for q_den",GSL_ENOMEM,0);}returnw;}
Using version 2.7 on Ubuntu 22.04 with the command: cppcheck --library=gnu work_u_.c
Error messages are probably similar in origin and strictly speaking they are false positives, but could accept pushing them to info level if there is a method to do that.
This code generates two errors in particular:
Using version 2.7 on Ubuntu 22.04 with the command:
cppcheck --library=gnu work_u_.c
Error messages are probably similar in origin and strictly speaking they are false positives, but could accept pushing them to info level if there is a method to do that.
Origin: https://git.savannah.gnu.org/cgit/gsl.git
Seems like GSL_ERROR_VAL is missing in gnu.cfg, so cppcheck doesn't know that it returns from the function.
Thanks, replaced the GSL_ERROR_VAL lines with
exit(GSL_ENOMEM)
for now and that works.