Task #34546 - units-2.17-5.el8/scan-results.err

back to task #34546
download
Error: CPPCHECK_WARNING (CWE-476):
units-2.17/units.c:552: error[nullPointer]: Null pointer dereference
#  550|     len = strlen(str)+1;
#  551|     widestr = mymalloc(sizeof(wchar_t)*len, "(strwidth)");
#  552|->   len = mbsrtowcs(widestr, &str, len, NULL);
#  553|   
#  554|     if (len==-1){

Error: COMPILER_WARNING (CWE-563):
units-2.17/units.c: scope_hint: In function 'readunits'
units-2.17/units.c:735:41: warning[-Wunused-value]: value computed is not used
#  735 | #define readerror (goterr=1) && errfile && fprintf
#      |                                         ^~
units-2.17/units.c:1560:9: note: in expansion of macro 'readerror'
# 1560 |         readerror(errfile, "%s: %s on line %d of '%s'\n",
#      |         ^~~~~~~~~
#  733|   
#  734|   
#  735|-> #define readerror (goterr=1) && errfile && fprintf
#  736|   
#  737|   #define VAGUE_ERR "%s: error in units file '%s' line %d\n", \

Error: CPPCHECK_WARNING (CWE-401):
units-2.17/units.c:1325: error[memleakOnRealloc]: Common realloc mistake: 'tab' nulled but not freed upon failure
# 1323|       if (tabpt>=tablealloc){
# 1324|         tablealloc+=20;
# 1325|->       tab = (struct pair *)realloc(tab,sizeof(struct pair)*tablealloc);
# 1326|         if (!tab){
# 1327|           if (errfile) fprintf(errfile, "%s: memory allocation error (newtable)\n",

Error: CPPCHECK_WARNING (CWE-476):
units-2.17/units.c:2287: error[ctunullpointer]: Null pointer dereference: first
# 2285|   {
# 2286|      return
# 2287|->       compareproducts(first->numerator, second->numerator, isdimless) ||
# 2288|         compareproducts(first->denominator, second->denominator, isdimless);
# 2289|   }

Error: COMPILER_WARNING (CWE-457):
units-2.17/units.c: scope_hint: In function 'showfunction'
units-2.17/units.c:2778:21: warning[-Wmaybe-uninitialized]: 'not_dimensionless' may be used uninitialized in this function
# 2778 |     if (func->dimen && (not_dimensionless || unit.factor != 1)){
#      |         ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 2776|         logprintf(num_format.format, *func->domain_min);
# 2777|       }
# 2778|->     if (func->dimen && (not_dimensionless || unit.factor != 1)){
# 2779|         if (isdecimal(*func->dimen))
# 2780|           logputs(" *");

Error: COMPILER_WARNING (CWE-563):
units-2.17/units.c: scope_hint: In function 'checkcwd'
units-2.17/units.c:3862:9: warning[-Wunused-variable]: unused variable 'p'
# 3862 |   char *p;
#      |         ^
# 3860|   {
# 3861|     FILE *fp;
# 3862|->   char *p;
# 3863|   
# 3864|     fp = fopen(file, "r");

Error: CPPCHECK_WARNING (CWE-672):
units-2.17/units.c:4222: error[deallocret]: Returning/dereferencing 'file' after it is deallocated / released
# 4220|     else {
# 4221|       fclose(testfile);
# 4222|->     return file;
# 4223|     }
# 4224|   }

Error: COMPILER_WARNING (CWE-563):
units-2.17/units.c: scope_hint: In function 'printversion'
units-2.17/units.c:4394:21: warning[-Wunused-variable]: unused variable 'localemap'
# 4394 |   char *unitsfile, *localemap;
#      |                     ^~~~~~~~~
# 4392|   {
# 4393|     int exists;
# 4394|->   char *unitsfile, *localemap;
# 4395|   
# 4396|     if (flags.verbose == 0) {