Task #311 - fixed.err
back to task #311download
Error: GCC_ANALYZER_WARNING (CWE-401): chkconfig-1.26-build/chkconfig-1.26/alternatives.c: scope_hint: In function ‘readConfig’ chkconfig-1.26-build/chkconfig-1.26/alternatives.c:247:19: warning[-Wanalyzer-malloc-leak]: leak of ‘parseLine(&buf)’ # 245| char *end; # 246| # 247|-> if (!*buf || !**buf) # 248| return NULL; # 249| Error: COMPILER_WARNING (CWE-704): chkconfig-1.26-build/chkconfig-1.26/alternatives.c: scope_hint: In function ‘readConfig’ chkconfig-1.26-build/chkconfig-1.26/alternatives.c:290:10: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type # 288| sprintf(path, "%s/%s", stateDir, title); # 289| # 290|-> path = normalize_path(path); # 291| # 292| if (FL_VERBOSE(flags)) Error: GCC_ANALYZER_WARNING (CWE-401): chkconfig-1.26-build/chkconfig-1.26/alternatives.c:297:20: warning[-Wanalyzer-malloc-leak]: leak of ‘groups’ chkconfig-1.26-build/chkconfig-1.26/alternatives.c:18: included_from: Included from here. # 295| if ((fd = open(path, O_RDONLY)) < 0) { # 296| if (errno == ENOENT) # 297|-> return 3; # 298| fprintf(stderr, _("failed to open %s: %s\n"), path, strerror(errno)); # 299| return 1; Error: GCC_ANALYZER_WARNING (CWE-401): chkconfig-1.26-build/chkconfig-1.26/alternatives.c:297:20: warning[-Wanalyzer-malloc-leak]: leak of ‘line’ # 295| if ((fd = open(path, O_RDONLY)) < 0) { # 296| if (errno == ENOENT) # 297|-> return 3; # 298| fprintf(stderr, _("failed to open %s: %s\n"), path, strerror(errno)); # 299| return 1; Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:323:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'line' # 321| set->mode = MANUAL; # 322| } else { # 323|-> fprintf(stderr, _("bad mode on line 1 of %s\n"), path); # 324| return 1; # 325| } Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:330:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'line' # 328| line = parseLine(&buf); # 329| if (!line || *line != '/') { # 330|-> fprintf(stderr, _("bad primary link in %s\n"), path); # 331| return 1; # 332| } Error: GCC_ANALYZER_WARNING (CWE-476): chkconfig-1.26-build/chkconfig-1.26/alternatives.c:335:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘groups’ # 333| # 334| groups = realloc(groups, sizeof(*groups)); # 335|-> groups[0].title = strdup(title); # 336| groups[0].facility = line; # 337| numGroups = 1; Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:343:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'line' # 341| if (*line == '/') { # 342| fprintf(stderr, _("path %s unexpected in %s\n"), line, path); # 343|-> return 1; # 344| } # 345| Error: GCC_ANALYZER_WARNING (CWE-401): chkconfig-1.26-build/chkconfig-1.26/alternatives.c:351:13: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’ chkconfig-1.26-build/chkconfig-1.26/alternatives.c:351:29: note: in expansion of macro ‘_’ # 349| line = parseLine(&buf); # 350| if (!line || !*line) { # 351|-> fprintf(stderr, _("missing path for follower %s in %s\n"), line, path); # 352| return 1; # 353| } Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:351:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'groups' # 349| line = parseLine(&buf); # 350| if (!line || !*line) { # 351|-> fprintf(stderr, _("missing path for follower %s in %s\n"), line, path); # 352| return 1; # 353| } Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:352:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'line' # 350| if (!line || !*line) { # 351| fprintf(stderr, _("missing path for follower %s in %s\n"), line, path); # 352|-> return 1; # 353| } # 354| Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:361:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'groups' # 359| # 360| if (!line) { # 361|-> fprintf(stderr, _("unexpected end of file in %s\n"), path); # 362| return 1; # 363| } Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:366:12: warning[unix.Malloc]: Potential leak of memory pointed to by 'line' # 364| # 365| line = parseLine(&buf); # 366|-> while (line && *line) { # 367| set->alts = realloc(set->alts, (set->numAlts + 1) * sizeof(*set->alts)); # 368| Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:410:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'line' # 408| fprintf(stderr, _("numeric priority expected in %s\n"), path); # 409| fprintf(stderr, _("unexpected line in %s: %s\n"), path, line); # 410|-> return 1; # 411| } # 412| if (end) { Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:446:22: warning[unix.Malloc]: Potential leak of memory pointed to by 'line' # 444| while (line) { # 445| line = parseLine(&buf); # 446|-> if (line && *line) { # 447| fprintf(stderr, _("unexpected line in %s: %s\n"), path, line); # 448| return 1; Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:448:13: warning[unix.Malloc]: Potential leak of memory pointed to by 'line' # 446| if (line && *line) { # 447| fprintf(stderr, _("unexpected line in %s: %s\n"), path, line); # 448|-> return 1; # 449| } # 450| } Error: GCC_ANALYZER_WARNING (CWE-688): chkconfig-1.26-build/chkconfig-1.26/alternatives.c: scope_hint: In function ‘fillTemplateFrom’ chkconfig-1.26-build/chkconfig-1.26/alternatives.c:729:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘template.followers’ where non-null expected chkconfig-1.26-build/chkconfig-1.26/alternatives.c: scope_hint: In function ‘fillTemplateFrom’ chkconfig-1.26-build/chkconfig-1.26/alternatives.c: scope_hint: In function ‘fillTemplateFrom’ <built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null # 727| template->numFollowers = source.numFollowers; # 728| template->followers = malloc(source.numFollowers * sizeof(struct linkSet)); # 729|-> memcpy(template->followers, source.followers, # 730| source.numFollowers * sizeof(struct linkSet)); # 731| } Error: GCC_ANALYZER_WARNING (CWE-401): chkconfig-1.26-build/chkconfig-1.26/alternatives.c: scope_hint: In function ‘addFollowerToAlternative’ chkconfig-1.26-build/chkconfig-1.26/alternatives.c:741:29: warning[-Wanalyzer-malloc-leak]: leak of ‘template.followers’ chkconfig-1.26-build/chkconfig-1.26/alternatives.c: scope_hint: In function ‘addFollowerToAlternative’ chkconfig-1.26-build/chkconfig-1.26/alternatives.c: scope_hint: In function ‘addFollowerToAlternative’ # 739| } # 740| if (i == template->numFollowers) { # 741|-> template->followers = # 742| realloc(template->followers, # 743| (template->numFollowers + 1) * sizeof(struct linkSet)); Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:780:21: warning[unix.Malloc]: Potential leak of memory pointed to by 'newLinks' # 778| if (strcmp(set->alts[k].followers[i].facility, # 779| template.followers[j].facility)) { # 780|-> fprintf( # 781| stderr, _("link %s incorrect for follower %s (%s %s)\n"), # 782| set->alts[k].followers[i].facility, Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:1242:20: warning[unix.Malloc]: Potential leak of memory pointed to by 'set.alts' # 1240| # 1241| if (readConfig(&set, ent->d_name, altDir, stateDir, flags)) # 1242|-> return 2; # 1243| # 1244| printf("%-*s\t%s\t%s\n", max_name, ent->d_name, Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:1248:5: warning[unix.Malloc]: Potential leak of memory pointed to by 'set.currentLink' # 1246| } # 1247| # 1248|-> closedir(dir); # 1249| # 1250| return 0; Error: GCC_ANALYZER_WARNING (CWE-401): chkconfig-1.26-build/chkconfig-1.26/alternatives.c: scope_hint: In function ‘main’ chkconfig-1.26-build/chkconfig-1.26/alternatives.c:1311:31: warning[-Wanalyzer-malloc-leak]: leak of ‘newAlt.initscript’ # 1309| if (!*nextArg) # 1310| usage(2); # 1311|-> newAlt.initscript = strdup(*nextArg); # 1312| nextArg++; # 1313| } else if (!strcmp(*nextArg, "--family")) { Error: GCC_ANALYZER_WARNING (CWE-401): chkconfig-1.26-build/chkconfig-1.26/alternatives.c:1320:27: warning[-Wanalyzer-malloc-leak]: leak of ‘newAlt.family’ # 1318| if (!*nextArg) # 1319| usage(2); # 1320|-> newAlt.family = strdup(*nextArg); # 1321| # 1322| if (strchr(newAlt.family, '@')) { Error: GCC_ANALYZER_WARNING (CWE-688): chkconfig-1.26-build/chkconfig-1.26/alternatives.c:1384:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘altDir’ where non-null expected chkconfig-1.26-build/chkconfig-1.26/alternatives.c:25: included_from: Included from here. /usr/include/sys/stat.h:205:12: note: argument 1 of ‘stat’ must be non-null # 1382| } # 1383| # 1384|-> if (stat(altDir, &sb) || !S_ISDIR(sb.st_mode) || access(altDir, F_OK)) { # 1385| fprintf(stderr, _("altdir %s invalid\n"), altDir); # 1386| return (2); Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:1385:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'stateDir' # 1383| # 1384| if (stat(altDir, &sb) || !S_ISDIR(sb.st_mode) || access(altDir, F_OK)) { # 1385|-> fprintf(stderr, _("altdir %s invalid\n"), altDir); # 1386| return (2); # 1387| } Error: CPPCHECK_WARNING (CWE-401): chkconfig-1.26-build/chkconfig-1.26/alternatives.c:1386: error[memleak]: Memory leak: newAlt.family # 1384| if (stat(altDir, &sb) || !S_ISDIR(sb.st_mode) || access(altDir, F_OK)) { # 1385| fprintf(stderr, _("altdir %s invalid\n"), altDir); # 1386|-> return (2); # 1387| } # 1388| Error: CPPCHECK_WARNING (CWE-401): chkconfig-1.26-build/chkconfig-1.26/alternatives.c:1386: error[memleak]: Memory leak: newAlt.initscript # 1384| if (stat(altDir, &sb) || !S_ISDIR(sb.st_mode) || access(altDir, F_OK)) { # 1385| fprintf(stderr, _("altdir %s invalid\n"), altDir); # 1386|-> return (2); # 1387| } # 1388| Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:1386:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'altDir' # 1384| if (stat(altDir, &sb) || !S_ISDIR(sb.st_mode) || access(altDir, F_OK)) { # 1385| fprintf(stderr, _("altdir %s invalid\n"), altDir); # 1386|-> return (2); # 1387| } # 1388| Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:1415:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'target' # 1413| return configService(title, altDir, stateDir, flags); # 1414| case MODE_SET: # 1415|-> return setService(title, target, altDir, stateDir, flags); # 1416| case MODE_REMOVE: # 1417| return removeService(title, target, altDir, stateDir, flags); Error: CLANG_WARNING: chkconfig-1.26-build/chkconfig-1.26/alternatives.c:1417:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'target' # 1415| return setService(title, target, altDir, stateDir, flags); # 1416| case MODE_REMOVE: # 1417|-> return removeService(title, target, altDir, stateDir, flags); # 1418| case MODE_REMOVE_ALL: # 1419| return removeAll(title, altDir, stateDir, flags);