Task #34544 - units-2.21-4.el9/scan-results.err
back to task #34544download
Error: COMPILER_WARNING (CWE-563):
units-2.21/units.c: scope_hint: In function 'openfile'
units-2.21/units.c:396:7: warning[-Wunused-variable]: unused variable 'ret'
# 396 | int ret;
# | ^~~
# 394| {
# 395| FILE *fileptr;
# 396|-> int ret;
# 397|
# 398| struct stat statbuf;
Error: CPPCHECK_WARNING (CWE-476):
units-2.21/units.c:621: error[nullPointer]: Null pointer dereference
# 619| len = strlen(str)+1;
# 620| widestr = mymalloc(sizeof(wchar_t)*len, "(strwidth)");
# 621|-> len = mbsrtowcs(widestr, &str, len, NULL);
# 622|
# 623| if (len==-1){
Error: COMPILER_WARNING (CWE-563):
units-2.21/units.c: scope_hint: In function 'readunits'
units-2.21/units.c:804:41: warning[-Wunused-value]: value computed is not used
# 804 | #define readerror (goterr=1) && errfile && fprintf
# | ^~
units-2.21/units.c:1645:9: note: in expansion of macro 'readerror'
# 1645 | readerror(errfile, "%s: %s on line %d of '%s'\n",
# | ^~~~~~~~~
# 802|
# 803|
# 804|-> #define readerror (goterr=1) && errfile && fprintf
# 805|
# 806| #define VAGUE_ERR "%s: error in units file '%s' line %d\n", \
Error: CPPCHECK_WARNING (CWE-401):
units-2.21/units.c:1408: error[memleakOnRealloc]: Common realloc mistake: 'tab' nulled but not freed upon failure
# 1406| if (tabpt>=tablealloc){
# 1407| tablealloc+=20;
# 1408|-> tab = (struct pair *)realloc(tab,sizeof(struct pair)*tablealloc);
# 1409| if (!tab){
# 1410| if (errfile) fprintf(errfile, "%s: memory allocation error (newtable)\n",
Error: CPPCHECK_WARNING (CWE-476):
units-2.21/units.c:2376: error[ctunullpointer]: Null pointer dereference: first
# 2374| {
# 2375| return
# 2376|-> compareproducts(first->numerator, second->numerator, isdimless) ||
# 2377| compareproducts(first->denominator, second->denominator, isdimless);
# 2378| }
Error: COMPILER_WARNING (CWE-457):
units-2.21/units.c: scope_hint: In function 'showfunction'
units-2.21/units.c:2848:21: warning[-Wmaybe-uninitialized]: 'not_dimensionless' may be used uninitialized in this function
# 2848 | if (func->dimen && (not_dimensionless || unit.factor != 1)){
# | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 2846| logprintf(num_format.format, *func->domain_min);
# 2847| }
# 2848|-> if (func->dimen && (not_dimensionless || unit.factor != 1)){
# 2849| if (isdecimal(*func->dimen))
# 2850| logputs(" *");
Error: COMPILER_WARNING (CWE-563):
units-2.21/units.c: scope_hint: In function 'checkcwd'
units-2.21/units.c:4131:9: warning[-Wunused-variable]: unused variable 'p'
# 4131 | char *p;
# | ^
# 4129| {
# 4130| FILE *fp;
# 4131|-> char *p;
# 4132|
# 4133| fp = openfile(file, "r");
Error: CPPCHECK_WARNING (CWE-672):
units-2.21/units.c:4536: error[deallocret]: Returning/dereferencing 'file' after it is deallocated / released
# 4534| else {
# 4535| fclose(testfile);
# 4536|-> return file;
# 4537| }
# 4538| }
Error: COMPILER_WARNING (CWE-563):
units-2.21/units.c: scope_hint: In function 'printversion'
units-2.21/units.c:4749:9: warning[-Wunused-variable]: unused variable 'fp'
# 4749 | FILE *fp, *histfile;
# | ^~
# 4747| char *m_unitsfile; /* personal units data file from HOME_UNITS_ENV */
# 4748| char *p_unitsfile; /* personal units data file */
# 4749|-> FILE *fp, *histfile;
# 4750| #ifdef _WIN32
# 4751| char *localemap;