Task #1867 - units-2.22-6.fc39/run0/scan-results.err
back to task #1867download
Error: CPPCHECK_WARNING (CWE-476): units-2.22/units.c:624: error[nullPointer]: Null pointer dereference # 622| len = strlen(str)+1; # 623| widestr = mymalloc(sizeof(wchar_t)*len, "(strwidth)"); # 624|-> len = mbsrtowcs(widestr, &str, len, NULL); # 625| # 626| if (len==-1){ Error: COMPILER_WARNING (CWE-563): units-2.22/units.c: scope_hint: In function ‘readunits’ units-2.22/units.c:807:41: warning[-Wunused-value]: value computed is not used # 807 | #define readerror (goterr=1) && errfile && fprintf # | ^~ units-2.22/units.c:1648:9: note: in expansion of macro ‘readerror’ # 1648 | readerror(errfile, "%s: %s on line %d of '%s'\n", # | ^~~~~~~~~ # 805| # 806| # 807|-> #define readerror (goterr=1) && errfile && fprintf # 808| # 809| #define VAGUE_ERR "%s: error in units file '%s' line %d\n", \ Error: CPPCHECK_WARNING (CWE-401): units-2.22/units.c:1411: error[memleakOnRealloc]: Common realloc mistake: 'tab' nulled but not freed upon failure # 1409| if (tabpt>=tablealloc){ # 1410| tablealloc+=20; # 1411|-> tab = (struct pair *)realloc(tab,sizeof(struct pair)*tablealloc); # 1412| if (!tab){ # 1413| if (errfile) fprintf(errfile, "%s: memory allocation error (newtable)\n", Error: CPPCHECK_WARNING (CWE-476): units-2.22/units.c:2391: error[ctunullpointer]: Null pointer dereference: first # 2389| { # 2390| return # 2391|-> compareproducts(first->numerator, second->numerator, isdimless) || # 2392| compareproducts(first->denominator, second->denominator, isdimless); # 2393| } Error: COMPILER_WARNING (CWE-457): units-2.22/units.c: scope_hint: In function ‘showfunction’ units-2.22/units.c:2872:8: warning[-Wmaybe-uninitialized]: ‘not_dimensionless’ may be used uninitialized # 2872 | if (not_dimensionless) # | ^ units-2.22/units.c:2828:7: note: ‘not_dimensionless’ was declared here # 2828 | int not_dimensionless, i; # | ^~~~~~~~~~~~~~~~~ # 2870| logputchar('\n'); # 2871| for(i=strwidth(deftext);i;i--) logputchar(' '); # 2872|-> if (not_dimensionless) # 2873| logprintf("%s has units %s",func->param, func->dimen); # 2874| else Error: CPPCHECK_WARNING (CWE-457): units-2.22/units.c:3698: error[legacyUninitvar]: Uninitialized variable: indent # 3696| if (errors[i]) { # 3697| lastchar(unittext) = '0'+i; # 3698|-> printf("%s%s(",indent,infunc->name); # 3699| printf(num_format.format, factor); # 3700| printf("%s): %s\n", unittext, errormsg[errors[i]]); Error: COMPILER_WARNING (CWE-563): units-2.22/units.c: scope_hint: In function ‘checkcwd’ units-2.22/units.c:4148:9: warning[-Wunused-variable]: unused variable ‘p’ # 4148 | char *p; # | ^ # 4146| { # 4147| FILE *fp; # 4148|-> char *p; # 4149| # 4150| fp = openfile(file, "r"); Error: CPPCHECK_WARNING (CWE-672): units-2.22/units.c:4553: error[deallocret]: Returning/dereferencing 'file' after it is deallocated / released # 4551| else { # 4552| fclose(testfile); # 4553|-> return file; # 4554| } # 4555| } Error: COMPILER_WARNING (CWE-563): units-2.22/units.c: scope_hint: In function ‘printversion’ units-2.22/units.c:4768:9: warning[-Wunused-variable]: unused variable ‘fp’ # 4768 | FILE *fp, *histfile; # | ^~ # 4766| char *m_unitsfile; /* personal units data file from HOME_UNITS_ENV */ # 4767| char *p_unitsfile; /* personal units data file */ # 4768|-> FILE *fp, *histfile; # 4769| #ifdef _WIN32 # 4770| char *localemap; Error: CPPCHECK_WARNING (CWE-476): units-2.22/units.c:5577: warning[nullPointer]: Possible null pointer dereference: lastunitstr # 5575| if (!value_shown) { /* provide output if every value rounded to zero */ # 5576| logputs("0 "); # 5577|-> if (isdecimal(*lastunitstr)) # 5578| logputs("* "); # 5579| logputs(lastunitstr);