# bluechi-0.9.0-0.202407301353.git5fc35bf

## List of Defects

    Error: GCC_ANALYZER_WARNING (CWE-401): [#def1]
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/agent.c:429:9: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc(1, 72)’
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/agent.c: scope_hint: In function ‘agent_create_request_full’
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/agent.c:2561:9: note: in expansion of macro ‘LIST_FOREACH_SAFE’
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/agent.c:2561:9: note: in expansion of macro ‘LIST_FOREACH_SAFE’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/network.h:17: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/agent.c:16: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/agent.c:439:9: note: in expansion of macro ‘bc_log_debugf’
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/agent.c:2698:9: note: in expansion of macro ‘bc_log_infof’
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/agent.c: scope_hint: In function ‘agent_create_request_full’
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/agent.c:236:57: note: in expansion of macro ‘malloc0’
    #  427|
    #  428|   Agent *agent_ref(Agent *agent) {
    #  429|->         assert(agent->ref_count > 0);
    #  430|
    #  431|           agent->ref_count++;

    Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/agent.c:429:21: warning[-Wanalyzer-malloc-leak]: leak of ‘calloc(1, 72)’
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/agent.c: scope_hint: In function ‘agent_create_request_full’
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/agent.c:2698:9: note: in expansion of macro ‘bc_log_infof’
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/agent.c: scope_hint: In function ‘agent_create_request_full’
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/agent.c:236:57: note: in expansion of macro ‘malloc0’
    #  427|
    #  428|   Agent *agent_ref(Agent *agent) {
    #  429|->         assert(agent->ref_count > 0);
    #  430|
    #  431|           agent->ref_count++;

    Error: CPPCHECK_WARNING (CWE-401): [#def3]
    bluechi-0.9.0-build/bluechi-0.9.0/src/controller/node.c:1440: error[memleak]: Memory leak: setup
    # 1438|           }
    # 1439|
    # 1440|->         return steal_pointer(&setup);
    # 1441|   }
    # 1442|

    Error: CPPCHECK_WARNING (CWE-401): [#def4]
    bluechi-0.9.0-build/bluechi-0.9.0/src/controller/node.c:1835: error[memleak]: Memory leak: unit_name_copy
    # 1833|           dep = malloc0(sizeof(ProxyDependency));
    # 1834|           if (dep == NULL) {
    # 1835|->                 return -ENOMEM;
    # 1836|           }
    # 1837|

    Error: CPPCHECK_WARNING (CWE-401): [#def5]
    bluechi-0.9.0-build/bluechi-0.9.0/src/controller/proxy_monitor.c:43: error[memleak]: Memory leak: monitor
    #   41|           monitor->unit_name = strdup(unit_name);
    #   42|           if (monitor->unit_name == NULL) {
    #   43|->                 return NULL;
    #   44|           }
    #   45|

    Error: CPPCHECK_WARNING (CWE-401): [#def6]
    bluechi-0.9.0-build/bluechi-0.9.0/src/controller/proxy_monitor.c:48: error[memleak]: Memory leak: monitor
    #   46|           monitor->proxy_object_path = strdup(proxy_object_path);
    #   47|           if (monitor->proxy_object_path == NULL) {
    #   48|->                 return NULL;
    #   49|           }
    #   50|

    Error: CPPCHECK_WARNING (CWE-401): [#def7]
    bluechi-0.9.0-build/bluechi-0.9.0/src/controller/proxy_monitor.c:48: error[memleak]: Memory leak: monitor.unit_name
    #   46|           monitor->proxy_object_path = strdup(proxy_object_path);
    #   47|           if (monitor->proxy_object_path == NULL) {
    #   48|->                 return NULL;
    #   49|           }
    #   50|

    Error: CPPCHECK_WARNING (CWE-401): [#def8]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/cli/command.c:106: error[memleak]: Memory leak: opt
    #  104|                   opt->value = strdup(value);
    #  105|                   if (opt->value == NULL) {
    #  106|->                         return -ENOMEM;
    #  107|                   }
    #  108|           } else {

    Error: GCC_ANALYZER_WARNING (CWE-401): [#def9]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/bus/utils.h:11: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/controller/controller.c:10: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/common.h: scope_hint: In function ‘controller_method_list_units’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/common.h:56:44: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc0_array(16, 24, (long unsigned int)*(Controller *)userdata.number_of_nodes)’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/common.h:67:16: note: in expansion of macro ‘malloc0’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/common.h:67:16: note: in expansion of macro ‘malloc0’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/common.h:15: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/controller/controller.c:745:9: note: in expansion of macro ‘LIST_FOREACH’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/common.h: scope_hint: In function ‘controller_method_list_units’
    #   54|   static inline void *malloc0_array(size_t base_size, size_t element_size, size_t n_elements) {
    #   55|           /* Check for overflow of multiplication */
    #   56|->         if (element_size > 0 && n_elements > SIZE_MAX / element_size) {
    #   57|                   return NULL;
    #   58|           }

    Error: GCC_ANALYZER_WARNING (CWE-476): [#def10]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/common.h:15: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/bus/utils.h:11: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/client.h:8: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-list-units.c:10: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-list-units.c: scope_hint: In function ‘fetch_unit_list’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/list.h:88:34: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘unit_list’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/list.h:52:17: note: in expansion of macro ‘LIST_FIND_TAIL’
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-list-units.c:74:17: note: in expansion of macro ‘LIST_APPEND’
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-list-units.c:134:51: note: in expansion of macro ‘malloc0’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/list.h:52:17: note: in expansion of macro ‘LIST_FIND_TAIL’
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-list-units.c:74:17: note: in expansion of macro ‘LIST_APPEND’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/list.h:52:17: note: in expansion of macro ‘LIST_FIND_TAIL’
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-list-units.c:74:17: note: in expansion of macro ‘LIST_APPEND’
    #   86|   #define LIST_FIND_TAIL(name, item, tail)                    \
    #   87|           do {                                                \
    #   88|->                 typeof(*(item)) *_item = (item);            \
    #   89|                   if (!_item)                                 \
    #   90|                           (tail) = NULL;                      \

    Error: GCC_ANALYZER_WARNING (CWE-688): [#def11]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/common.h:17: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/agent.h:15: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/test/agent/agent_apply_config_test.c:10: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/test/agent/agent_apply_config_test.c: scope_hint: In function ‘check_str’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/string-util.h:14:22: warning[-Wanalyzer-null-argument]: use of NULL ‘expected’ where non-null expected
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/test/agent/agent_apply_config_test.c:36:14: note: in expansion of macro ‘streq’
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/test/agent/agent_apply_config_test.c:36:14: note: in expansion of macro ‘streq’
    bluechi-0.9.0-build/bluechi-0.9.0/src/agent/test/agent/agent_apply_config_test.c:36:14: note: in expansion of macro ‘streq’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/common.h:9: included_from: Included from here.
    /usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null
    #   12|   #include "protocol.h"
    #   13|
    #   14|-> #define streq(a, b) (strcmp((a), (b)) == 0)
    #   15|   #define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)
    #   16|

    Error: GCC_ANALYZER_WARNING (CWE-688): [#def12]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/common.h:17: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/cli/command.h:8: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-status.h:8: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-status.c:6: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-status.c: scope_hint: In function ‘node_connection_fmt_last_seen’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/string-util.h:14:22: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*con.state’ where non-null expected
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-status.c:484:13: note: in expansion of macro ‘streq’
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-status.c:475:24: note: in expansion of macro ‘malloc0’
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-status.c: scope_hint: In function ‘node_connection_fmt_last_seen’
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-status.c:725:21: note: in expansion of macro ‘streq’
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-status.c:457:28: note: in expansion of macro ‘malloc0’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/common.h:15: included_from: Included from here.
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/list.h:52:17: note: in expansion of macro ‘LIST_FIND_TAIL’
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-status.c:470:9: note: in expansion of macro ‘LIST_APPEND’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/list.h:53:17: note: in expansion of macro ‘LIST_INSERT_AFTER’
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-status.c:470:9: note: in expansion of macro ‘LIST_APPEND’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/list.h:53:17: note: in expansion of macro ‘LIST_INSERT_AFTER’
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-status.c:470:9: note: in expansion of macro ‘LIST_APPEND’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/list.h:53:17: note: in expansion of macro ‘LIST_INSERT_AFTER’
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-status.c:470:9: note: in expansion of macro ‘LIST_APPEND’
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-status.c:548:9: note: in expansion of macro ‘LIST_FOREACH_SAFE’
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-status.c:548:9: note: in expansion of macro ‘LIST_FOREACH_SAFE’
    bluechi-0.9.0-build/bluechi-0.9.0/src/client/method-status.c:484:13: note: in expansion of macro ‘streq’
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/common/common.h:9: included_from: Included from here.
    /usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null
    #   12|   #include "protocol.h"
    #   13|
    #   14|-> #define streq(a, b) (strcmp((a), (b)) == 0)
    #   15|   #define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)
    #   16|

    Error: CPPCHECK_WARNING (CWE-476): [#def13]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/test/common/cfg/cfg_get_set_test.c:31: warning[nullPointer]: Possible null pointer dereference: expected_value
    #   29|           assert(null_value || found_value != NULL);
    #   30|
    #   31|->         assert(null_value || streq(value, expected_value));
    #   32|   }
    #   33|

    Error: CPPCHECK_WARNING (CWE-476): [#def14]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/test/common/cfg/cfg_get_set_test.c:31: warning[nullPointer]: Possible null pointer dereference: value
    #   29|           assert(null_value || found_value != NULL);
    #   30|
    #   31|->         assert(null_value || streq(value, expected_value));
    #   32|   }
    #   33|

    Error: CPPCHECK_WARNING (CWE-476): [#def15]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/test/common/network/assemble_tcp_address.c:77: warning[nullPointer]: Possible null pointer dereference: expectedResult
    #   75|           _cleanup_free_ char *result = assemble_tcp_address(input);
    #   76|           if ((result == NULL && expectedResult != NULL) || (result != NULL && expectedResult == NULL) ||
    #   77|->             (result != NULL && !streq(result, expectedResult))) {
    #   78|                   _cleanup_free_ char *msg = NULL;
    #   79|                   int r = asprintf(

    Error: CPPCHECK_WARNING (CWE-476): [#def16]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/test/common/network/is_ipv4_test.c:21: warning[nullPointer]: Possible null pointer dereference: in
    #   19|           fprintf(stdout,
    #   20|                   "FAILED: is_ipv4('%s') - Expected %s, but got %s\n",
    #   21|->                 in,
    #   22|                   bool_to_str(expected),
    #   23|                   bool_to_str(result));

    Error: CPPCHECK_WARNING (CWE-476): [#def17]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/test/common/network/is_ipv6_test.c:21: warning[nullPointer]: Possible null pointer dereference: in
    #   19|           fprintf(stdout,
    #   20|                   "FAILED: is_ipv6('%s') - Expected %s, but got %s\n",
    #   21|->                 in,
    #   22|                   bool_to_str(expected),
    #   23|                   bool_to_str(result));

    Error: CPPCHECK_WARNING (CWE-476): [#def18]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/test/common/string-util/ends_with_test.c:20: warning[nullPointer]: Possible null pointer dereference: str
    #   18|           fprintf(stdout,
    #   19|                   "FAILED: ends_with('%s', '%s') - Expected %s, but got %s\n",
    #   20|->                 str,
    #   21|                   suffix,
    #   22|                   bool_to_str(does_end_with),

    Error: CPPCHECK_WARNING (CWE-476): [#def19]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/test/common/string-util/ends_with_test.c:21: warning[nullPointer]: Possible null pointer dereference: suffix
    #   19|                   "FAILED: ends_with('%s', '%s') - Expected %s, but got %s\n",
    #   20|                   str,
    #   21|->                 suffix,
    #   22|                   bool_to_str(does_end_with),
    #   23|                   bool_to_str(result));

    Error: CPPCHECK_WARNING (CWE-476): [#def20]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/test/common/string-util/match_glob_test.c:20: warning[nullPointer]: Possible null pointer dereference: in
    #   18|           fprintf(stdout,
    #   19|                   "FAILED: is_glob('%s') - Expected %s, but got %s\n",
    #   20|->                 in,
    #   21|                   bool_to_str(expected),
    #   22|                   bool_to_str(result));

    Error: CPPCHECK_WARNING (CWE-476): [#def21]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/test/common/string-util/match_glob_test.c:33: warning[nullPointer]: Possible null pointer dereference: in
    #   31|           fprintf(stdout,
    #   32|                   "FAILED: match_glob('%s', '%s') - Expected %s, but got %s\n",
    #   33|->                 in,
    #   34|                   glob,
    #   35|                   bool_to_str(expected),

    Error: CPPCHECK_WARNING (CWE-476): [#def22]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/test/common/string-util/match_glob_test.c:34: warning[nullPointer]: Possible null pointer dereference: glob
    #   32|                   "FAILED: match_glob('%s', '%s') - Expected %s, but got %s\n",
    #   33|                   in,
    #   34|->                 glob,
    #   35|                   bool_to_str(expected),
    #   36|                   bool_to_str(result));

    Error: CPPCHECK_WARNING (CWE-476): [#def23]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/test/log/log_target_to_str_test.c:24: warning[nullPointer]: Possible null pointer dereference: expected_log_target
    #   22|           fprintf(stdout,
    #   23|                   "FAILED: string_to_log_level - Expected '%s', but got '%s'\n",
    #   24|->                 expected_log_target,
    #   25|                   result);
    #   26|           return false;

    Error: CPPCHECK_WARNING (CWE-476): [#def24]
    bluechi-0.9.0-build/bluechi-0.9.0/src/libbluechi/test/log/string_to_log_level_test.c:20: warning[nullPointer]: Possible null pointer dereference: in
    #   18|           fprintf(stdout,
    #   19|                   "FAILED: string_to_log_level('%s') - Expected %s, but got %s\n",
    #   20|->                 in,
    #   21|                   log_level_to_string(expected_log_level),
    #   22|                   log_level_to_string(result));

## Scan Properties

analyzer-version-cppcheck | 2.14.2
analyzer-version-gcc | 14.1.1
analyzer-version-gcc-analyzer | 14.1.1
analyzer-version-shellcheck | 0.10.0
enabled-plugins | cppcheck, gcc, shellcheck
exit-code | 0
host | ip-172-16-1-174.us-west-2.compute.internal
mock-config | fedora-rawhide-x86_64
project-name | bluechi-0.9.0-0.202407301353.git5fc35bf
store-results-to | /tmp/tmp0o3bt545/bluechi-0.9.0-0.202407301353.git5fc35bf.tar.xz
time-created | 2024-08-02 00:34:47
time-finished | 2024-08-02 00:36:21
tool | csmock
tool-args | '/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,shellcheck,cppcheck' '-o' '/tmp/tmp0o3bt545/bluechi-0.9.0-0.202407301353.git5fc35bf.tar.xz' '--gcc-analyze' '--cppcheck-add-flag=--check-level=exhaustive' '/tmp/tmp0o3bt545/bluechi-0.9.0-0.202407301353.git5fc35bf.src.rpm'
tool-version | csmock-3.6.0-1.el9