chkconfig-1.32-1.fc43

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1]
chkconfig-1.32/alternatives.c:300:5: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘set’
chkconfig-1.32/alternatives.c:1372:5: enter_function: entry to ‘main’
chkconfig-1.32/alternatives.c:1389:8: branch_false: following ‘false’ branch...
chkconfig-1.32/alternatives.c:1392:15: branch_false: ...to here
chkconfig-1.32/alternatives.c:1393:12: branch_true: following ‘true’ branch...
chkconfig-1.32/alternatives.c:1394:14: branch_true: ...to here
chkconfig-1.32/alternatives.c:1394:12: branch_false: following ‘false’ branch (when the strings are non-equal)...
chkconfig-1.32/alternatives.c:1408:21: branch_false: ...to here
chkconfig-1.32/alternatives.c:1408:19: branch_false: following ‘false’ branch...
chkconfig-1.32/alternatives.c:1411:19: branch_false: following ‘false’ branch...
chkconfig-1.32/alternatives.c:1414:16: branch_false: following ‘false’ branch...
chkconfig-1.32/alternatives.c:1416:16: branch_false: ...to here
chkconfig-1.32/alternatives.c:1416:16: branch_true: following ‘true’ branch...
chkconfig-1.32/alternatives.c:1417:17: branch_true: ...to here
chkconfig-1.32/alternatives.c:1420:40: release_memory: ‘0’ is NULL
chkconfig-1.32/alternatives.c:1422:13: release_memory: ‘0’ is NULL
chkconfig-1.32/alternatives.c:1422:13: call_function: calling ‘setupLinkSet’ from ‘main’
#  298|       if (!*nextArg || **nextArg != '/')
#  299|           usage(2);
#  300|->     set->facility = normalize_path_alloc(*nextArg);
#  301|       nextArg++;
#  302|   

Error: CPPCHECK_WARNING (CWE-401): [#def2]
chkconfig-1.32/alternatives.c:415: error[memleakOnRealloc]: Common realloc mistake: 'groups' nulled but not freed upon failure
#  413|       }
#  414|   
#  415|->     groups = realloc(groups, sizeof(*groups));
#  416|       groups[0].title = strdup(title);
#  417|       groups[0].facility = strsteal(&line);

Error: CPPCHECK_WARNING (CWE-401): [#def3]
chkconfig-1.32/alternatives.c:439: error[memleakOnRealloc]: Common realloc mistake: 'groups' nulled but not freed upon failure
#  437|           newGroup.facility = strsteal(&line);
#  438|   
#  439|->         groups = realloc(groups, sizeof(*groups) * (numGroups + 1));
#  440|           groups[numGroups++] = newGroup;
#  441|           newGroup.title = newGroup.facility = NULL;

Error: COMPILER_WARNING (CWE-252): [#def4]
chkconfig-1.32/alternatives.c: scope_hint: In function ‘makeLinks’
chkconfig-1.32/alternatives.c:671:13: warning[-Wunused-result]: ignoring return value of ‘readlink’ declared with attribute ‘warn_unused_result’
#  671 |             readlink(l->facility, buf, sizeof(buf)-1);
#      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  669|           } else {
#  670|               memset(buf, 0, sizeof(buf));
#  671|->             readlink(l->facility, buf, sizeof(buf)-1);
#  672|   
#  673|               if(!streq(sl, buf)) {

Error: COMPILER_WARNING (CWE-252): [#def5]
chkconfig-1.32/alternatives.c:689:9: warning[-Wunused-result]: ignoring return value of ‘readlink’ declared with attribute ‘warn_unused_result’
#  689 |         readlink(sl, buf, sizeof(buf)-1);
#      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  687|       } else {
#  688|           memset(buf, 0, sizeof(buf));
#  689|->         readlink(sl, buf, sizeof(buf)-1);
#  690|   
#  691|           if(!streq(l->target, buf)) {

Error: COMPILER_WARNING (CWE-252): [#def6]
chkconfig-1.32/alternatives.c: scope_hint: In function ‘writeState’
chkconfig-1.32/alternatives.c:791:17: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
#  791 |                 asprintf(&path, "/bin/systemctl -q is-enabled %s.service || "
#      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  792 |                                 "/bin/systemctl -q preset %s.service",
#      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  793 |                          alt->initscript, alt->initscript);
#      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  789|           if (alt->initscript) {
#  790|               if (isSystemd(alt->initscript)) {
#  791|->                 asprintf(&path, "/bin/systemctl -q is-enabled %s.service || "
#  792|                                   "/bin/systemctl -q preset %s.service",
#  793|                            alt->initscript, alt->initscript);

Error: COMPILER_WARNING (CWE-252): [#def7]
chkconfig-1.32/alternatives.c:796:17: warning[-Wunused-result]: ignoring return value of ‘system’ declared with attribute ‘warn_unused_result’
#  796 |                 system(path);
#      |                 ^~~~~~~~~~~~
#  794|                   if (FL_VERBOSE(flags))
#  795|                       printf(_("running %s\n"), path);
#  796|->                 system(path);
#  797|                   free(path);
#  798|               } else {

Error: COMPILER_WARNING (CWE-252): [#def8]
chkconfig-1.32/alternatives.c:799:17: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
#  799 |                 asprintf(&path, "/sbin/chkconfig --add %s", alt->initscript);
#      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  797|                   free(path);
#  798|               } else {
#  799|->                 asprintf(&path, "/sbin/chkconfig --add %s", alt->initscript);
#  800|                   if (FL_VERBOSE(flags))
#  801|                       printf(_("running %s\n"), path);

Error: COMPILER_WARNING (CWE-252): [#def9]
chkconfig-1.32/alternatives.c:802:17: warning[-Wunused-result]: ignoring return value of ‘system’ declared with attribute ‘warn_unused_result’
#  802 |                 system(path);
#      |                 ^~~~~~~~~~~~
#  800|                   if (FL_VERBOSE(flags))
#  801|                       printf(_("running %s\n"), path);
#  802|->                 system(path);
#  803|                   free(path);
#  804|               }

Error: COMPILER_WARNING (CWE-252): [#def10]
chkconfig-1.32/alternatives.c:810:21: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
#  810 |                     asprintf(&path, "/bin/systemctl -q disable %s.service",
#      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  811 |                              tmpalt->initscript);
#      |                              ~~~~~~~~~~~~~~~~~~~
#  808|               if (tmpalt != alt && tmpalt->initscript) {
#  809|                   if (isSystemd(tmpalt->initscript)) {
#  810|->                     asprintf(&path, "/bin/systemctl -q disable %s.service",
#  811|                                tmpalt->initscript);
#  812|                       if (FL_VERBOSE(flags))

Error: COMPILER_WARNING (CWE-252): [#def11]
chkconfig-1.32/alternatives.c:814:21: warning[-Wunused-result]: ignoring return value of ‘system’ declared with attribute ‘warn_unused_result’
#  814 |                     system(path);
#      |                     ^~~~~~~~~~~~
#  812|                       if (FL_VERBOSE(flags))
#  813|                           printf(_("running %s\n"), path);
#  814|->                     system(path);
#  815|                       free(path);
#  816|                   } else {

Error: COMPILER_WARNING (CWE-252): [#def12]
chkconfig-1.32/alternatives.c:817:21: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
#  817 |                     asprintf(&path, "/sbin/chkconfig --del %s",
#      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  818 |                              tmpalt->initscript);
#      |                              ~~~~~~~~~~~~~~~~~~~
#  815|                       free(path);
#  816|                   } else {
#  817|->                     asprintf(&path, "/sbin/chkconfig --del %s",
#  818|                                tmpalt->initscript);
#  819|                       if (FL_VERBOSE(flags))

Error: COMPILER_WARNING (CWE-252): [#def13]
chkconfig-1.32/alternatives.c:821:21: warning[-Wunused-result]: ignoring return value of ‘system’ declared with attribute ‘warn_unused_result’
#  821 |                     system(path);
#      |                     ^~~~~~~~~~~~
#  819|                       if (FL_VERBOSE(flags))
#  820|                           printf(_("running %s\n"), path);
#  821|->                     system(path);
#  822|                       free(path);
#  823|                   }

Error: COMPILER_WARNING (CWE-252): [#def14]
chkconfig-1.32/alternatives.c: scope_hint: In function ‘configService’
chkconfig-1.32/alternatives.c:1158:17: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
# 1158 |                 asprintf(&nicer, "%s (%s)", set.alts[i].family,
#      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1159 |                          set.alts[i].leader.target);
#      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1156|           for (i = 0; i < set.numAlts; i++) {
# 1157|               if (set.alts[i].family)
# 1158|->                 asprintf(&nicer, "%s (%s)", set.alts[i].family,
# 1159|                            set.alts[i].leader.target);
# 1160|               printf("%c%c %-4d        %s\n", i == set.best ? '*' : ' ',

Error: GCC_ANALYZER_WARNING (CWE-688): [#def15]
chkconfig-1.32/alternatives.c:1442:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘newAlt.family’ where non-null expected
chkconfig-1.32/alternatives.c:1389:8: branch_false: following ‘false’ branch...
chkconfig-1.32/alternatives.c:1392:15: branch_false: ...to here
chkconfig-1.32/alternatives.c:1393:12: branch_true: following ‘true’ branch...
chkconfig-1.32/alternatives.c:1394:14: branch_true: ...to here
chkconfig-1.32/alternatives.c:1394:12: branch_false: following ‘false’ branch (when the strings are non-equal)...
chkconfig-1.32/alternatives.c:1408:21: branch_false: ...to here
chkconfig-1.32/alternatives.c:1408:19: branch_false: following ‘false’ branch...
chkconfig-1.32/alternatives.c:1411:19: branch_false: following ‘false’ branch...
chkconfig-1.32/alternatives.c:1413:19: branch_false: following ‘false’ branch...
chkconfig-1.32/alternatives.c:1424:19: branch_false: following ‘false’ branch (when the strings are non-equal)...
chkconfig-1.32/alternatives.c:1433:21: branch_false: ...to here
chkconfig-1.32/alternatives.c:1433:19: branch_true: following ‘true’ branch (when the strings are equal)...
chkconfig-1.32/alternatives.c:1434:17: branch_true: ...to here
chkconfig-1.32/alternatives.c:1434:16: branch_false: following ‘false’ branch...
chkconfig-1.32/alternatives.c:1436:13: branch_false: ...to here
chkconfig-1.32/alternatives.c:1438:16: branch_false: following ‘false’ branch...
chkconfig-1.32/alternatives.c:1440:29: branch_false: ...to here
chkconfig-1.32/alternatives.c:1440:29: acquire_memory: this call could return NULL
chkconfig-1.32/alternatives.c:1442:17: danger: argument 1 (‘strdup(*<unknown>)’) from [(21)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/20) could be NULL where non-null expected
#argument 1 of ‘__builtin_strchr’ must be non-null
# 1440|               newAlt.family = strdup(*nextArg);
# 1441|   
# 1442|->             if (strchr(newAlt.family, '@')) {
# 1443|                   printf(_("--family can't contain the symbol '@'\n"));
# 1444|                   usage(2);

Error: COMPILER_WARNING (CWE-252): [#def16]
chkconfig-1.32/chkconfig.c: scope_hint: In function ‘reloadSystemd’
chkconfig-1.32/chkconfig.c:106:9: warning[-Wunused-result]: ignoring return value of ‘system’ declared with attribute ‘warn_unused_result’
#  106 |         system("systemctl daemon-reload > /dev/null 2>&1");
#      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  104|   static void reloadSystemd(void) {
#  105|       if (systemdActive())
#  106|->         system("systemctl daemon-reload > /dev/null 2>&1");
#  107|   }
#  108|   

Error: CPPCHECK_WARNING (CWE-401): [#def17]
chkconfig-1.32/chkconfig.c:584: error[memleakOnRealloc]: Common realloc mistake: 's' nulled but not freed upon failure
#  582|               if (numServices == numServicesAlloced) {
#  583|                   numServicesAlloced += 10;
#  584|->                 s = realloc(s, numServicesAlloced * sizeof(*s));
#  585|               }
#  586|               if (readXinetdServiceInfo(ent->d_name, s + numServices) != -1)

Error: CPPCHECK_WARNING (CWE-476): [#def18]
chkconfig-1.32/chkconfig.c:590: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: s
#  588|           }
#  589|   
#  590|->         qsort(s, numServices, sizeof(*s), serviceNameCmp);
#  591|           t = s;
#  592|           for (i = 0; i < numServices; i++, s++) {

Error: COMPILER_WARNING (CWE-252): [#def19]
chkconfig-1.32/chkconfig.c: scope_hint: In function ‘setService’
chkconfig-1.32/chkconfig.c:672:9: warning[-Wunused-result]: ignoring return value of ‘system’ declared with attribute ‘warn_unused_result’
#  672 |         system("/sbin/service xinetd reload >/dev/null 2>&1");
#      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  670|               return 1;
#  671|           }
#  672|->         system("/sbin/service xinetd reload >/dev/null 2>&1");
#  673|       }
#  674|   

Error: COMPILER_WARNING (CWE-252): [#def20]
chkconfig-1.32/chkconfig.c: scope_hint: In function ‘forwardSystemd’
chkconfig-1.32/chkconfig.c:691:13: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
#  691 |             asprintf(&p, "%s.service", name);
#      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  689|   
#  690|           if (!socket)
#  691|->             asprintf(&p, "%s.service", name);
#  692|           else
#  693|               asprintf(&p, "%s.socket", name);

Error: COMPILER_WARNING (CWE-252): [#def21]
chkconfig-1.32/chkconfig.c:693:13: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
#  693 |             asprintf(&p, "%s.socket", name);
#      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  691|               asprintf(&p, "%s.service", name);
#  692|           else
#  693|->             asprintf(&p, "%s.socket", name);
#  694|   
#  695|           fprintf(stderr, _("Note: Forwarding request to 'systemctl %s %s'.\n"),

Error: CPPCHECK_WARNING (CWE-401): [#def22]
chkconfig-1.32/leveldb.c:177: error[memleakOnRealloc]: Common realloc mistake: 'desc' nulled but not freed upon failure
#  175|   
#  176|               i = strlen(desc);
#  177|->             desc = realloc(desc, i + end - start + 1);
#  178|               strncat(desc, start, end - start);
#  179|               desc[i + end - start] = '\0';

Error: CPPCHECK_WARNING (CWE-401): [#def23]
chkconfig-1.32/leveldb.c:376: error[memleakOnRealloc]: Common realloc mistake: 'servs' nulled but not freed upon failure
#  374|           if (!S_ISREG(sb.st_mode))
#  375|               continue;
#  376|->         servs = realloc(servs, (numservs + 1) * sizeof(struct service));
#  377|           if (!readServiceInfo(ent->d_name, TYPE_INIT_D, servs + numservs, 0))
#  378|               numservs++;

Error: COMPILER_WARNING (CWE-252): [#def24]
chkconfig-1.32/leveldb.c: scope_hint: In function ‘readServiceInfo’
chkconfig-1.32/leveldb.c:396:5: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
#  396 |     asprintf(&filename, RUNLEVELS "/init.d/%s", name);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  394|           goto try_xinetd;
#  395|   
#  396|->     asprintf(&filename, RUNLEVELS "/init.d/%s", name);
#  397|   
#  398|       if ((fd = open(filename, O_RDONLY)) < 0)

Error: COMPILER_WARNING (CWE-252): [#def25]
chkconfig-1.32/leveldb.c:406:5: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
#  406 |     asprintf(&filename, RUNLEVELS "/chkconfig.d/%s", name);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  404|           return parseret;
#  405|   
#  406|->     asprintf(&filename, RUNLEVELS "/chkconfig.d/%s", name);
#  407|       if ((fd = open(filename, O_RDONLY)) >= 0) {
#  408|           parseret = parseServiceInfo(fd, name, &serv_overrides, honorHide, 1);

Error: COMPILER_WARNING (CWE-252): [#def26]
chkconfig-1.32/leveldb.c: scope_hint: In function ‘readServiceDifferences’
chkconfig-1.32/leveldb.c:457:5: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
#  457 |     asprintf(&filename, RUNLEVELS "/init.d/%s", name);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  455|           goto try_xinetd;
#  456|   
#  457|->     asprintf(&filename, RUNLEVELS "/init.d/%s", name);
#  458|   
#  459|       if ((fd = open(filename, O_RDONLY)) < 0) {

Error: COMPILER_WARNING (CWE-252): [#def27]
chkconfig-1.32/leveldb.c:469:5: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
#  469 |     asprintf(&filename, RUNLEVELS "/chkconfig.d/%s", name);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  467|       }
#  468|   
#  469|->     asprintf(&filename, RUNLEVELS "/chkconfig.d/%s", name);
#  470|       if ((fd = open(filename, O_RDONLY)) >= 0) {
#  471|           parseret = parseServiceInfo(fd, name, &serv_overrides, honorHide, 1);

Error: CPPCHECK_WARNING (CWE-401): [#def28]
chkconfig-1.32/leveldb.c:510: error[memleakOnRealloc]: Common realloc mistake: 'deps' nulled but not freed upon failure
#  508|           }
#  509|           numdeps++;
#  510|->         deps = realloc(deps, (numdeps + 1) * sizeof(struct dep));
#  511|           deps[numdeps - 1].name = strdup(pos);
#  512|           deps[numdeps - 1].handled = 0;

Error: GCC_ANALYZER_WARNING (CWE-415): [#def29]
chkconfig-1.32/leveldb.c:510:16: warning[-Wanalyzer-double-free]: double-‘free’ of ‘deps’
chkconfig-1.32/leveldb.c:522:5: enter_function: entry to ‘parseServiceInfo’
chkconfig-1.32/leveldb.c:526:20: release_memory: first ‘free’ here
chkconfig-1.32/leveldb.c:526:20: release_memory: first ‘free’ here
chkconfig-1.32/leveldb.c:526:20: release_memory: first ‘free’ here
chkconfig-1.32/leveldb.c:526:20: release_memory: first ‘free’ here
chkconfig-1.32/leveldb.c:549:8: branch_false: following ‘false’ branch (when ‘bufstart != 18446744073709551615’)...
chkconfig-1.32/leveldb.c:554:34: branch_false: ...to here
chkconfig-1.32/leveldb.c:555:8: branch_false: following ‘false’ branch (when ‘tmpbufstart’ is non-NULL)...
chkconfig-1.32/leveldb.c:561:5: branch_false: ...to here
chkconfig-1.32/leveldb.c:571:12: branch_true: following ‘true’ branch...
chkconfig-1.32/leveldb.c:574:16: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:576:12: branch_false: ...to here
chkconfig-1.32/leveldb.c:576:12: branch_false: following ‘false’ branch (when ‘start != bufstop’)...
chkconfig-1.32/leveldb.c:579:15: branch_false: ...to here
chkconfig-1.32/leveldb.c:580:12: branch_true: following ‘true’ branch (when ‘end’ is NULL)...
chkconfig-1.32/leveldb.c:585:12: branch_true: ...to here
chkconfig-1.32/leveldb.c:585:12: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:588:9: branch_false: ...to here
chkconfig-1.32/leveldb.c:594:12: branch_false: following ‘false’ branch (when ‘start != end’)...
chkconfig-1.32/leveldb.c:596:12: branch_false: ...to here
chkconfig-1.32/leveldb.c:608:12: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:652:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:652:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:653:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:652:20: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:659:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:659:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:665:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:665:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:681:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:681:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:697:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:697:19: branch_true: following ‘true’ branch...
chkconfig-1.32/leveldb.c:698:13: branch_true: ...to here
chkconfig-1.32/leveldb.c:699:30: call_function: calling ‘parseDeps’ from ‘parseServiceInfo’
#  508|           }
#  509|           numdeps++;
#  510|->         deps = realloc(deps, (numdeps + 1) * sizeof(struct dep));
#  511|           deps[numdeps - 1].name = strdup(pos);
#  512|           deps[numdeps - 1].handled = 0;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def30]
chkconfig-1.32/leveldb.c:511:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘deps’
chkconfig-1.32/leveldb.c:522:5: enter_function: entry to ‘parseServiceInfo’
chkconfig-1.32/leveldb.c:526:20: release_memory: ‘serv.startDeps’ is NULL
chkconfig-1.32/leveldb.c:526:20: release_memory: ‘serv.stopDeps’ is NULL
chkconfig-1.32/leveldb.c:526:20: release_memory: ‘serv.stopDeps’ is NULL
chkconfig-1.32/leveldb.c:526:20: release_memory: ‘serv.stopDeps’ is NULL
chkconfig-1.32/leveldb.c:549:8: branch_false: following ‘false’ branch (when ‘bufstart != 18446744073709551615’)...
chkconfig-1.32/leveldb.c:554:34: branch_false: ...to here
chkconfig-1.32/leveldb.c:555:8: branch_false: following ‘false’ branch (when ‘tmpbufstart’ is non-NULL)...
chkconfig-1.32/leveldb.c:561:5: branch_false: ...to here
chkconfig-1.32/leveldb.c:571:12: branch_true: following ‘true’ branch...
chkconfig-1.32/leveldb.c:574:16: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:576:12: branch_false: ...to here
chkconfig-1.32/leveldb.c:576:12: branch_false: following ‘false’ branch (when ‘start != bufstop’)...
chkconfig-1.32/leveldb.c:579:15: branch_false: ...to here
chkconfig-1.32/leveldb.c:580:12: branch_true: following ‘true’ branch (when ‘end’ is NULL)...
chkconfig-1.32/leveldb.c:585:12: branch_true: ...to here
chkconfig-1.32/leveldb.c:585:12: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:588:9: branch_false: ...to here
chkconfig-1.32/leveldb.c:594:12: branch_false: following ‘false’ branch (when ‘start != end’)...
chkconfig-1.32/leveldb.c:596:12: branch_false: ...to here
chkconfig-1.32/leveldb.c:608:12: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:652:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:652:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:653:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:652:20: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:659:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:659:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:665:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:665:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:681:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:681:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:697:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:697:19: branch_true: following ‘true’ branch...
chkconfig-1.32/leveldb.c:698:13: branch_true: ...to here
chkconfig-1.32/leveldb.c:699:30: call_function: calling ‘parseDeps’ from ‘parseServiceInfo’
#  509|           numdeps++;
#  510|           deps = realloc(deps, (numdeps + 1) * sizeof(struct dep));
#  511|->         deps[numdeps - 1].name = strdup(pos);
#  512|           deps[numdeps - 1].handled = 0;
#  513|           memset(&deps[numdeps], '\0', sizeof(struct dep));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def31]
chkconfig-1.32/leveldb.c:511:13: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
chkconfig-1.32/leveldb.c:522:5: enter_function: entry to ‘parseServiceInfo’
chkconfig-1.32/leveldb.c:549:8: branch_false: following ‘false’ branch (when ‘bufstart != 18446744073709551615’)...
chkconfig-1.32/leveldb.c:554:34: branch_false: ...to here
chkconfig-1.32/leveldb.c:555:8: branch_false: following ‘false’ branch (when ‘tmpbufstart’ is non-NULL)...
chkconfig-1.32/leveldb.c:561:5: branch_false: ...to here
chkconfig-1.32/leveldb.c:571:12: branch_true: following ‘true’ branch...
chkconfig-1.32/leveldb.c:574:16: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:576:12: branch_false: ...to here
chkconfig-1.32/leveldb.c:576:12: branch_false: following ‘false’ branch (when ‘start != bufstop’)...
chkconfig-1.32/leveldb.c:579:15: branch_false: ...to here
chkconfig-1.32/leveldb.c:580:12: branch_true: following ‘true’ branch (when ‘end’ is NULL)...
chkconfig-1.32/leveldb.c:585:12: branch_true: ...to here
chkconfig-1.32/leveldb.c:585:12: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:588:9: branch_false: ...to here
chkconfig-1.32/leveldb.c:594:12: branch_false: following ‘false’ branch (when ‘start != end’)...
chkconfig-1.32/leveldb.c:596:12: branch_false: ...to here
chkconfig-1.32/leveldb.c:608:12: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:652:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:652:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:653:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:652:20: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:659:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:659:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:665:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:665:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:681:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:681:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:697:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:697:19: branch_true: following ‘true’ branch...
chkconfig-1.32/leveldb.c:698:13: branch_true: ...to here
chkconfig-1.32/leveldb.c:699:30: call_function: calling ‘parseDeps’ from ‘parseServiceInfo’
#  509|           numdeps++;
#  510|           deps = realloc(deps, (numdeps + 1) * sizeof(struct dep));
#  511|->         deps[numdeps - 1].name = strdup(pos);
#  512|           deps[numdeps - 1].handled = 0;
#  513|           memset(&deps[numdeps], '\0', sizeof(struct dep));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def32]
chkconfig-1.32/leveldb.c:727:17: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
chkconfig-1.32/leveldb.c:549:8: branch_false: following ‘false’ branch (when ‘bufstart != 18446744073709551615’)...
chkconfig-1.32/leveldb.c:554:34: branch_false: ...to here
chkconfig-1.32/leveldb.c:555:8: branch_false: following ‘false’ branch (when ‘tmpbufstart’ is non-NULL)...
chkconfig-1.32/leveldb.c:561:5: branch_false: ...to here
chkconfig-1.32/leveldb.c:571:12: branch_true: following ‘true’ branch...
chkconfig-1.32/leveldb.c:574:16: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:576:12: branch_false: ...to here
chkconfig-1.32/leveldb.c:576:12: branch_false: following ‘false’ branch (when ‘start != bufstop’)...
chkconfig-1.32/leveldb.c:579:15: branch_false: ...to here
chkconfig-1.32/leveldb.c:580:12: branch_true: following ‘true’ branch (when ‘end’ is NULL)...
chkconfig-1.32/leveldb.c:585:12: branch_true: ...to here
chkconfig-1.32/leveldb.c:585:12: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:588:9: branch_false: ...to here
chkconfig-1.32/leveldb.c:594:12: branch_false: following ‘false’ branch (when ‘start != end’)...
chkconfig-1.32/leveldb.c:596:12: branch_false: ...to here
chkconfig-1.32/leveldb.c:608:12: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:652:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:652:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:653:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:652:20: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:659:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:659:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:665:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:665:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:681:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:681:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:697:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:697:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:700:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:700:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:703:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:703:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:706:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:706:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:709:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:709:19: branch_true: following ‘true’ branch...
chkconfig-1.32/leveldb.c:713:13: branch_true: ...to here
chkconfig-1.32/leveldb.c:717:20: branch_false: following ‘false’ branch (when ‘start != end’)...
 branch_false: ...to here
chkconfig-1.32/leveldb.c:722:20: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:726:17: branch_false: ...to here
chkconfig-1.32/leveldb.c:729:46: acquire_memory: allocated here
chkconfig-1.32/leveldb.c:731:20: branch_false: following ‘false’ branch...
 branch_false: ...to here
chkconfig-1.32/leveldb.c:717:20: branch_false: following ‘false’ branch (when ‘start != end’)...
 branch_false: ...to here
chkconfig-1.32/leveldb.c:722:20: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:726:17: branch_false: ...to here
chkconfig-1.32/leveldb.c:727:17: danger: ‘<unknown>’ leaks here; was allocated at [(45)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/44)
#  725|                   }
#  726|                   numdeps++;
#  727|->                 serv.provides =
#  728|                       realloc(serv.provides, (numdeps + 1) * sizeof(char *));
#  729|                   serv.provides[numdeps - 1] = strdup(start);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def33]
chkconfig-1.32/leveldb.c:729:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
chkconfig-1.32/leveldb.c:526:20: release_memory: ‘serv.provides’ is NULL
chkconfig-1.32/leveldb.c:549:8: branch_false: following ‘false’ branch (when ‘bufstart != 18446744073709551615’)...
chkconfig-1.32/leveldb.c:554:34: branch_false: ...to here
chkconfig-1.32/leveldb.c:555:8: branch_false: following ‘false’ branch (when ‘tmpbufstart’ is non-NULL)...
chkconfig-1.32/leveldb.c:561:5: branch_false: ...to here
chkconfig-1.32/leveldb.c:571:12: branch_true: following ‘true’ branch...
chkconfig-1.32/leveldb.c:574:16: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:576:12: branch_false: ...to here
chkconfig-1.32/leveldb.c:576:12: branch_false: following ‘false’ branch (when ‘start != bufstop’)...
chkconfig-1.32/leveldb.c:579:15: branch_false: ...to here
chkconfig-1.32/leveldb.c:580:12: branch_true: following ‘true’ branch (when ‘end’ is NULL)...
chkconfig-1.32/leveldb.c:585:12: branch_true: ...to here
chkconfig-1.32/leveldb.c:585:12: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:588:9: branch_false: ...to here
chkconfig-1.32/leveldb.c:594:12: branch_false: following ‘false’ branch (when ‘start != end’)...
chkconfig-1.32/leveldb.c:596:12: branch_false: ...to here
chkconfig-1.32/leveldb.c:608:12: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:652:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:652:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:653:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:652:20: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:659:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:659:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:665:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:665:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:681:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:681:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:697:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:697:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:700:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:700:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:703:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:703:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:706:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:706:19: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:709:21: branch_false: ...to here
chkconfig-1.32/leveldb.c:709:19: branch_true: following ‘true’ branch...
chkconfig-1.32/leveldb.c:713:13: branch_true: ...to here
chkconfig-1.32/leveldb.c:717:20: branch_false: following ‘false’ branch (when ‘start != end’)...
 branch_false: ...to here
chkconfig-1.32/leveldb.c:722:20: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:726:17: branch_false: ...to here
chkconfig-1.32/leveldb.c:728:29: release_memory: ‘serv.provides’ is NULL
chkconfig-1.32/leveldb.c:729:30: release_memory: ‘0’ is NULL
chkconfig-1.32/leveldb.c:729:30: release_memory: ‘0’ is NULL
chkconfig-1.32/leveldb.c:729:17: danger: dereference of NULL ‘realloc(serv.provides, (long unsigned int)(numdeps + 2) * 8) + ((long unsigned int)numdeps + 18446744073709551615) * 8’
#  727|                   serv.provides =
#  728|                       realloc(serv.provides, (numdeps + 1) * sizeof(char *));
#  729|->                 serv.provides[numdeps - 1] = strdup(start);
#  730|                   serv.provides[numdeps] = NULL;
#  731|                   if (!t || t >= end)

Error: GCC_ANALYZER_WARNING (CWE-688): [#def34]
chkconfig-1.32/leveldb.c:911:15: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘buf’ where non-null expected
chkconfig-1.32/leveldb.c:884:8: branch_false: following ‘false’ branch (when ‘on != -1’)...
chkconfig-1.32/leveldb.c:887:5: branch_false: ...to here
chkconfig-1.32/leveldb.c:888:8: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:891:5: branch_false: ...to here
chkconfig-1.32/leveldb.c:892:11: acquire_memory: this call could return NULL
chkconfig-1.32/leveldb.c:893:8: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:898:5: branch_false: ...to here
chkconfig-1.32/leveldb.c:904:8: branch_false: following ‘false’ branch...
 branch_false: ...to here
chkconfig-1.32/leveldb.c:909:12: branch_true: following ‘true’ branch (when ‘buf’ is non-NULL)...
chkconfig-1.32/leveldb.c:911:15: branch_true: ...to here
chkconfig-1.32/leveldb.c:911:15: danger: argument 1 (‘buf’) from [(5)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
#argument 1 of ‘__builtin_strchr’ must be non-null
#  909|       while (buf) {
#  910|           tmp = buf;
#  911|->         ptr = strchr(buf, '\n');
#  912|           if (ptr) {
#  913|               *ptr = '\0';

Error: COMPILER_WARNING (CWE-252): [#def35]
chkconfig-1.32/leveldb.c: scope_hint: In function ‘setXinetdService’
chkconfig-1.32/leveldb.c:919:13: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
#  919 |             write(newfd, tmp, strlen(tmp));
#      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  917|               buf++;
#  918|           if (strncmp(buf, "disable", 7) && strlen(buf)) {
#  919|->             write(newfd, tmp, strlen(tmp));
#  920|               write(newfd, "\n", 1);
#  921|               if (buf[0] == '{') {

Error: COMPILER_WARNING (CWE-252): [#def36]
chkconfig-1.32/leveldb.c:920:13: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
#  920 |             write(newfd, "\n", 1);
#      |             ^~~~~~~~~~~~~~~~~~~~~
#  918|           if (strncmp(buf, "disable", 7) && strlen(buf)) {
#  919|               write(newfd, tmp, strlen(tmp));
#  920|->             write(newfd, "\n", 1);
#  921|               if (buf[0] == '{') {
#  922|                   snprintf(tmpstr, 50, "\tdisable\t= %s", on ? "no" : "yes");

Error: COMPILER_WARNING (CWE-252): [#def37]
chkconfig-1.32/leveldb.c:923:17: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
#  923 |                 write(newfd, tmpstr, strlen(tmpstr));
#      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  921|               if (buf[0] == '{') {
#  922|                   snprintf(tmpstr, 50, "\tdisable\t= %s", on ? "no" : "yes");
#  923|->                 write(newfd, tmpstr, strlen(tmpstr));
#  924|                   write(newfd, "\n", 1);
#  925|               }

Error: COMPILER_WARNING (CWE-252): [#def38]
chkconfig-1.32/leveldb.c:924:17: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
#  924 |                 write(newfd, "\n", 1);
#      |                 ^~~~~~~~~~~~~~~~~~~~~
#  922|                   snprintf(tmpstr, 50, "\tdisable\t= %s", on ? "no" : "yes");
#  923|                   write(newfd, tmpstr, strlen(tmpstr));
#  924|->                 write(newfd, "\n", 1);
#  925|               }
#  926|           }

Error: COMPILER_WARNING (CWE-252): [#def39]
chkconfig-1.32/leveldb.c: scope_hint: In function ‘isOverriddenBySystemd’
chkconfig-1.32/leveldb.c:993:5: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
#  993 |     asprintf(&p, SYSTEMD_SERVICE_PATH "/%s.service", service);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  991|       int rc = 0;
#  992|   
#  993|->     asprintf(&p, SYSTEMD_SERVICE_PATH "/%s.service", service);
#  994|   
#  995|       if (access(p, F_OK) >= 0) {

Error: COMPILER_WARNING (CWE-252): [#def40]
chkconfig-1.32/leveldb.c:1000:5: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
# 1000 |     asprintf(&p, SYSTEMD_LOCAL_SERVICE_PATH "/%s.service", service);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  998|       }
#  999|       free(p);
# 1000|->     asprintf(&p, SYSTEMD_LOCAL_SERVICE_PATH "/%s.service", service);
# 1001|       if (access(p, F_OK) >= 0) {
# 1002|           rc = 1;

Error: COMPILER_WARNING (CWE-252): [#def41]
chkconfig-1.32/leveldb.c: scope_hint: In function ‘isSocketActivatedBySystemd’
chkconfig-1.32/leveldb.c:1014:5: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
# 1014 |     asprintf(&p, SYSTEMD_SERVICE_PATH "/%s@.service", service);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1012|       int rc = 0;
# 1013|   
# 1014|->     asprintf(&p, SYSTEMD_SERVICE_PATH "/%s@.service", service);
# 1015|       asprintf(&s, SYSTEMD_SERVICE_PATH "/%s.socket", service);
# 1016|   

Error: COMPILER_WARNING (CWE-252): [#def42]
chkconfig-1.32/leveldb.c:1015:5: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
# 1015 |     asprintf(&s, SYSTEMD_SERVICE_PATH "/%s.socket", service);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1013|   
# 1014|       asprintf(&p, SYSTEMD_SERVICE_PATH "/%s@.service", service);
# 1015|->     asprintf(&s, SYSTEMD_SERVICE_PATH "/%s.socket", service);
# 1016|   
# 1017|       if (access(p, F_OK) >= 0 && access(s, F_OK) >= 0) {

Error: COMPILER_WARNING (CWE-252): [#def43]
chkconfig-1.32/leveldb.c:1024:5: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
# 1024 |     asprintf(&p, SYSTEMD_LOCAL_SERVICE_PATH "/%s@.service", service);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1022|       free(s);
# 1023|   
# 1024|->     asprintf(&p, SYSTEMD_LOCAL_SERVICE_PATH "/%s@.service", service);
# 1025|       asprintf(&s, SYSTEMD_LOCAL_SERVICE_PATH "/%s.socket", service);
# 1026|       if (access(p, F_OK) >= 0 && access(s, F_OK) >= 0) {

Error: COMPILER_WARNING (CWE-252): [#def44]
chkconfig-1.32/leveldb.c:1025:5: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
# 1025 |     asprintf(&s, SYSTEMD_LOCAL_SERVICE_PATH "/%s.socket", service);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1023|   
# 1024|       asprintf(&p, SYSTEMD_LOCAL_SERVICE_PATH "/%s@.service", service);
# 1025|->     asprintf(&s, SYSTEMD_LOCAL_SERVICE_PATH "/%s.socket", service);
# 1026|       if (access(p, F_OK) >= 0 && access(s, F_OK) >= 0) {
# 1027|           rc = 1;

Error: GCC_ANALYZER_WARNING (CWE-415): [#def45]
chkconfig-1.32/leveldb.c:1143:32: warning[-Wanalyzer-double-free]: double-‘free’ of ‘ret’
chkconfig-1.32/leveldb.c:1119:5: enter_function: entry to ‘runlevelsToTargets’
chkconfig-1.32/leveldb.c:1128:17: branch_true: following ‘true’ branch (when ‘i != 7’)...
chkconfig-1.32/leveldb.c:1129:13: branch_true: ...to here
chkconfig-1.32/leveldb.c:1129:12: branch_true: following ‘true’ branch...
chkconfig-1.32/leveldb.c:1130:19: branch_true: ...to here
chkconfig-1.32/leveldb.c:1132:17: call_function: calling ‘readSystemdUnitProperty’ from ‘runlevelsToTargets’
chkconfig-1.32/leveldb.c:1132:17: return_function: returning to ‘runlevelsToTargets’ from ‘readSystemdUnitProperty’
chkconfig-1.32/leveldb.c:1133:16: branch_false: following ‘false’ branch...
 branch_false: ...to here
chkconfig-1.32/leveldb.c:1135:25: branch_false: following ‘false’ branch (when ‘n_ret <= j’)...
chkconfig-1.32/leveldb.c:1142:16: branch_false: ...to here
chkconfig-1.32/leveldb.c:1142:16: branch_true: following ‘true’ branch (when ‘found == 0’)...
chkconfig-1.32/leveldb.c:1143:62: branch_true: ...to here
chkconfig-1.32/leveldb.c:1143:32: danger: second ‘free’ here
# 1141|   
# 1142|               if (!found) {
# 1143|->                 tmp = (char **)realloc(ret, sizeof(char *) * (n_ret + 1));
# 1144|                   if (tmp == NULL) {
# 1145|                       free(t);

Error: COMPILER_WARNING (CWE-252): [#def46]
chkconfig-1.32/leveldb.c: scope_hint: In function ‘serviceNameToUnit’
chkconfig-1.32/leveldb.c:1192:9: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
# 1192 |         asprintf(&ret, "%s.service", service);
#      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1190|           ret = strdup("time-sync.target");
# 1191|       } else {
# 1192|->         asprintf(&ret, "%s.service", service);
# 1193|       }
# 1194|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def47]
chkconfig-1.32/leveldb.c:1307:5: warning[-Wanalyzer-null-argument]: use of NULL ‘deps’ where non-null expected
chkconfig-1.32/leveldb.c:1297:12: release_memory: ‘deps’ is NULL
chkconfig-1.32/leveldb.c:1304:8: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:1307:5: branch_false: ...to here
chkconfig-1.32/leveldb.c:1307:5: release_memory: ‘deps’ is NULL
chkconfig-1.32/leveldb.c:1307:5: danger: argument 1 (‘deps’) NULL where non-null expected
# 1305|           return 0;
# 1306|   
# 1307|->     qsort(deps, n_deps, sizeof(char *), cmpstringp);
# 1308|   
# 1309|       r = systemdIsSimilarlyConfiguredDeps(star, n_star, deps, n_deps);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def48]
chkconfig-1.32/leveldb.c:1332:5: warning[-Wanalyzer-null-argument]: use of NULL ‘star’ where non-null expected
chkconfig-1.32/leveldb.c:1320:6: enter_function: entry to ‘checkSystemdDependencies’
chkconfig-1.32/leveldb.c:1321:12: release_memory: ‘star’ is NULL
chkconfig-1.32/leveldb.c:1327:9: call_function: calling ‘runlevelsToTargets’ from ‘checkSystemdDependencies’
chkconfig-1.32/leveldb.c:1327:9: return_function: returning to ‘checkSystemdDependencies’ from ‘runlevelsToTargets’
chkconfig-1.32/leveldb.c:1329:8: branch_false: following ‘false’ branch...
chkconfig-1.32/leveldb.c:1332:5: branch_false: ...to here
chkconfig-1.32/leveldb.c:1332:5: release_memory: ‘star’ is NULL
chkconfig-1.32/leveldb.c:1332:5: danger: argument 1 (‘star’) NULL where non-null expected
# 1330|           return;
# 1331|   
# 1332|->     qsort(star, n_star, sizeof(char *), cmpstringp);
# 1333|   
# 1334|       if (s->startDeps) {

Error: COMPILER_WARNING (CWE-252): [#def49]
chkconfig-1.32/ntsysv.c: scope_hint: In function ‘servicesWindow’
chkconfig-1.32/ntsysv.c:166:13: warning[-Wunused-result]: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’
#  166 |             asprintf(&cmd, "/usr/bin/systemctl %s %s >/dev/null 2>&1",
#      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  167 |                      en ? "enable" : "disable", services[i].name);
#      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  164|               else
#  165|                   continue;
#  166|->             asprintf(&cmd, "/usr/bin/systemctl %s %s >/dev/null 2>&1",
#  167|                        en ? "enable" : "disable", services[i].name);
#  168|               if (cmd == NULL)

Error: COMPILER_WARNING (CWE-252): [#def50]
chkconfig-1.32/ntsysv.c:170:13: warning[-Wunused-result]: ignoring return value of ‘system’ declared with attribute ‘warn_unused_result’
#  170 |             system(cmd);
#      |             ^~~~~~~~~~~
#  168|               if (cmd == NULL)
#  169|                   return 1;
#  170|->             system(cmd);
#  171|               free(cmd);
#  172|           } else {

Error: CPPCHECK_WARNING (CWE-401): [#def51]
chkconfig-1.32/ntsysv.c:343: error[memleakOnRealloc]: Common realloc mistake: 'services' nulled but not freed upon failure
#  341|           if (numServices == numServicesAlloced) {
#  342|               numServicesAlloced += 10;
#  343|->             services =
#  344|                   realloc(services, numServicesAlloced * sizeof(*services));
#  345|           }

Error: CPPCHECK_WARNING (CWE-401): [#def52]
chkconfig-1.32/ntsysv.c:395: error[memleakOnRealloc]: Common realloc mistake: 'services' nulled but not freed upon failure
#  393|               if (numServices == numServicesAlloced) {
#  394|                   numServicesAlloced += 10;
#  395|->                 services =
#  396|                       realloc(services, numServicesAlloced * sizeof(*services));
#  397|               }

Scan Properties

analyzer-version-clippy1.86.0
analyzer-version-cppcheck2.17.1
analyzer-version-gcc15.0.1
analyzer-version-gcc-analyzer15.0.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-182.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250425.124705.g1c7c448.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namechkconfig-1.32-1.fc43
store-results-to/tmp/tmpalj_nw2w/chkconfig-1.32-1.fc43.tar.xz
time-created2025-04-25 12:27:29
time-finished2025-04-25 12:28:39
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmpalj_nw2w/chkconfig-1.32-1.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpalj_nw2w/chkconfig-1.32-1.fc43.src.rpm'
tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9