ddcutil-2.2.1-1.fc44

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-775): [#def1]
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:145:7: warning[-Wanalyzer-file-leak]: leak of FILE 'output_fp'
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:107:1: enter_function: entry to 'app_dumpvcp_as_file'
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:117:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:118:29: branch_true: ...to here
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:120:10: branch_true: following 'true' branch (when 'filename' is non-NULL)...
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:121:22: branch_true: ...to here
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:121:22: acquire_resource: opened here
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:122:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:126:28: call_function: inlined call to 'g_strdup_inline' from 'app_dumpvcp_as_file'
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:145:7: danger: 'output_fp' leaks here; was opened at [(6)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/5)
#  143|            }
#  144|         }
#  145|->       free_dumpload_data(data);
#  146|   
#  147|         if (output_fp) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def2]
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:145:7: warning[-Wanalyzer-malloc-leak]: leak of 'output_fp'
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:107:1: enter_function: entry to 'app_dumpvcp_as_file'
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:117:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:118:29: branch_true: ...to here
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:120:10: branch_true: following 'true' branch (when 'filename' is non-NULL)...
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:121:22: branch_true: ...to here
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:121:22: acquire_memory: allocated here
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:122:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:126:28: call_function: inlined call to 'g_strdup_inline' from 'app_dumpvcp_as_file'
ddcutil-2.2.1/src/app_ddcutil/app_dumpload.c:145:7: danger: 'output_fp' leaks here; was allocated at [(6)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/5)
#  143|            }
#  144|         }
#  145|->       free_dumpload_data(data);
#  146|   
#  147|         if (output_fp) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def3]
ddcutil-2.2.1/src/app_sysenv/query_sysenv.c:545:36: warning[-Wanalyzer-malloc-leak]: leak of 'opendir(appdir)'
ddcutil-2.2.1/src/app_sysenv/query_sysenv.c:538:22: branch_true: following 'true' branch (when 'dirname' is non-NULL)...
ddcutil-2.2.1/src/app_sysenv/query_sysenv.c:539:32: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv.c:542:17: acquire_memory: allocated here
ddcutil-2.2.1/src/app_sysenv/query_sysenv.c:543:10: branch_true: following 'true' branch...
 branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv.c:545:36: danger: 'opendir(appdir)' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  543|         if (d) {
#  544|            struct dirent *directory_entry;
#  545|->          while ((directory_entry = readdir(d)) != NULL) {
#  546|               // printf("%s\n", directory_entry->d_name);
#  547|               if (directory_entry->d_type == DT_REG) {

Error: CPPCHECK_WARNING (CWE-476): [#def4]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:193: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: accum
#  191|   Env_Accumulator * env_accumulator_new() {
#  192|      Env_Accumulator * accum = calloc(1, sizeof(Env_Accumulator));
#  193|->    memcpy(accum->marker, ENV_ACCUMULATOR_MARKER, 4);
#  194|   
#  195|      // Defaults that differ from 0 values set by calloc():

Error: CPPCHECK_WARNING (CWE-476): [#def5]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:196: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: accum
#  194|   
#  195|      // Defaults that differ from 0 values set by calloc():
#  196|->    accum->dev_i2c_devices_required  = true;
#  197|   
#  198|      // will be set false if any instance fails the test

Error: GCC_ANALYZER_WARNING (CWE-476): [#def6]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:196:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'accum'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:192:30: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:196:4: danger: 'accum' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  194|   
#  195|      // Defaults that differ from 0 values set by calloc():
#  196|->    accum->dev_i2c_devices_required  = true;
#  197|   
#  198|      // will be set false if any instance fails the test

Error: CPPCHECK_WARNING (CWE-476): [#def7]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:199: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: accum
#  197|   
#  198|      // will be set false if any instance fails the test
#  199|->    accum->cur_user_all_devi2c_rw    = true;
#  200|      accum->all_dev_i2c_has_group_i2c = true;
#  201|      accum->all_dev_i2c_is_group_rw   = true;

Error: CPPCHECK_WARNING (CWE-476): [#def8]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:200: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: accum
#  198|      // will be set false if any instance fails the test
#  199|      accum->cur_user_all_devi2c_rw    = true;
#  200|->    accum->all_dev_i2c_has_group_i2c = true;
#  201|      accum->all_dev_i2c_is_group_rw   = true;
#  202|   

Error: CPPCHECK_WARNING (CWE-476): [#def9]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:201: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: accum
#  199|      accum->cur_user_all_devi2c_rw    = true;
#  200|      accum->all_dev_i2c_has_group_i2c = true;
#  201|->    accum->all_dev_i2c_is_group_rw   = true;
#  202|   
#  203|      return accum;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def10]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:247:43: warning[-Wanalyzer-malloc-leak]: leak of 'driver_names'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:234:6: enter_function: entry to 'env_accumulator_report'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:242:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:243:22: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:243:22: call_function: calling 'driver_name_list_string' from 'env_accumulator_report'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:243:22: return_function: returning to 'env_accumulator_report' from 'driver_name_list_string'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:246:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:247:43: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:247:43: danger: 'driver_names' leaks here; was allocated at [(12)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/11)
#  245|      char * sys_bus_i2c_device_numbers_string = "";
#  246|      if (accum->sys_bus_i2c_device_numbers)
#  247|->       sys_bus_i2c_device_numbers_string = bva_as_string(accum->sys_bus_i2c_device_numbers, /*as_hex*/ false, " ");
#  248|   
#  249|      rpt_label(depth, "Env_Accumulator:");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def11]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:249:4: warning[-Wanalyzer-malloc-leak]: leak of 'driver_names'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:234:6: enter_function: entry to 'env_accumulator_report'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:242:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:243:22: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:243:22: call_function: calling 'driver_name_list_string' from 'env_accumulator_report'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:243:22: return_function: returning to 'env_accumulator_report' from 'driver_name_list_string'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:249:4: danger: 'driver_names' leaks here; was allocated at [(12)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/11)
#  247|         sys_bus_i2c_device_numbers_string = bva_as_string(accum->sys_bus_i2c_device_numbers, /*as_hex*/ false, " ");
#  248|   
#  249|->    rpt_label(depth, "Env_Accumulator:");
#  250|      rpt_vstring(d1, "%-30s %s", "architecture:",  (accum->architecture)   ? accum->architecture   : "");
#  251|      rpt_vstring(d1, "%-30s %s", "distributor_id", (accum->distributor_id) ? accum->distributor_id : "");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def12]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:250:4: warning[-Wanalyzer-malloc-leak]: leak of 'driver_names'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:234:6: enter_function: entry to 'env_accumulator_report'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:242:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:243:22: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:243:22: call_function: calling 'driver_name_list_string' from 'env_accumulator_report'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:243:22: return_function: returning to 'env_accumulator_report' from 'driver_name_list_string'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:250:4: danger: 'driver_names' leaks here; was allocated at [(12)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/11)
#  248|   
#  249|      rpt_label(depth, "Env_Accumulator:");
#  250|->    rpt_vstring(d1, "%-30s %s", "architecture:",  (accum->architecture)   ? accum->architecture   : "");
#  251|      rpt_vstring(d1, "%-30s %s", "distributor_id", (accum->distributor_id) ? accum->distributor_id : "");
#  252|      rpt_vstring(d1, "%-30s %s", "Drivers detected:",          driver_names);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def13]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:251:4: warning[-Wanalyzer-malloc-leak]: leak of 'driver_names'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:234:6: enter_function: entry to 'env_accumulator_report'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:242:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:243:22: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:243:22: call_function: calling 'driver_name_list_string' from 'env_accumulator_report'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:243:22: return_function: returning to 'env_accumulator_report' from 'driver_name_list_string'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:251:4: danger: 'driver_names' leaks here; was allocated at [(12)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/11)
#  249|      rpt_label(depth, "Env_Accumulator:");
#  250|      rpt_vstring(d1, "%-30s %s", "architecture:",  (accum->architecture)   ? accum->architecture   : "");
#  251|->    rpt_vstring(d1, "%-30s %s", "distributor_id", (accum->distributor_id) ? accum->distributor_id : "");
#  252|      rpt_vstring(d1, "%-30s %s", "Drivers detected:",          driver_names);
#  253|      rpt_vstring(d1, "%-30s %s", "/dev/i2c device numbers:",   dev_i2c_device_numbers_string);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def14]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:252:4: warning[-Wanalyzer-malloc-leak]: leak of 'driver_names'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:234:6: enter_function: entry to 'env_accumulator_report'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:242:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:243:22: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:243:22: call_function: calling 'driver_name_list_string' from 'env_accumulator_report'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:243:22: return_function: returning to 'env_accumulator_report' from 'driver_name_list_string'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:252:4: danger: 'driver_names' leaks here; was allocated at [(12)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/11)
#  250|      rpt_vstring(d1, "%-30s %s", "architecture:",  (accum->architecture)   ? accum->architecture   : "");
#  251|      rpt_vstring(d1, "%-30s %s", "distributor_id", (accum->distributor_id) ? accum->distributor_id : "");
#  252|->    rpt_vstring(d1, "%-30s %s", "Drivers detected:",          driver_names);
#  253|      rpt_vstring(d1, "%-30s %s", "/dev/i2c device numbers:",   dev_i2c_device_numbers_string);
#  254|      rpt_vstring(d1, "%-30s %s", "sysfs_i2c_devices_exist:",   sbool(accum->sysfs_i2c_devices_exist));

Error: CPPCHECK_WARNING (CWE-476): [#def15]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:336: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: newnode
#  334|      if (!driver_name_list_find_exact(*headptr, driver_name)) {
#  335|         Driver_Name_Node * newnode = calloc(1, sizeof(Driver_Name_Node));
#  336|->       newnode->driver_name = g_strdup(driver_name);
#  337|         newnode->next = *headptr;
#  338|         *headptr = newnode;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def16]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:336:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'newnode'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:332:6: enter_function: entry to 'driver_name_list_add'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:334:9: call_function: calling 'driver_name_list_find_exact' from 'driver_name_list_add'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:334:9: return_function: returning to 'driver_name_list_add' from 'driver_name_list_find_exact'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:334:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:335:36: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:335:36: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:336:7: danger: 'newnode' could be NULL: unchecked value from [(9)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/8)
#  334|      if (!driver_name_list_find_exact(*headptr, driver_name)) {
#  335|         Driver_Name_Node * newnode = calloc(1, sizeof(Driver_Name_Node));
#  336|->       newnode->driver_name = g_strdup(driver_name);
#  337|         newnode->next = *headptr;
#  338|         *headptr = newnode;

Error: CPPCHECK_WARNING (CWE-476): [#def17]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:337: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: newnode
#  335|         Driver_Name_Node * newnode = calloc(1, sizeof(Driver_Name_Node));
#  336|         newnode->driver_name = g_strdup(driver_name);
#  337|->       newnode->next = *headptr;
#  338|         *headptr = newnode;
#  339|      }

Error: CPPCHECK_WARNING (CWE-476): [#def18]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:425: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  423|      // printf("(%s) reqd_sz = %d\n", __func__, reqd_sz);
#  424|      char * result = malloc(reqd_sz);
#  425|->    result[0] = '\0';
#  426|      cur = head;
#  427|      while(cur) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def19]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:425:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:424:20: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:425:4: danger: 'result' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/0)
#  423|      // printf("(%s) reqd_sz = %d\n", __func__, reqd_sz);
#  424|      char * result = malloc(reqd_sz);
#  425|->    result[0] = '\0';
#  426|      cur = head;
#  427|      while(cur) {

Error: CPPCHECK_WARNING (CWE-476): [#def20]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:430: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  428|         if (cur != head)
#  429|            strcat(result, ", ");
#  430|->       strcat(result, cur->driver_name);
#  431|         cur = cur->next;
#  432|      }

Error: CPPCHECK_WARNING (CWE-476): [#def21]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_base.c:433: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  431|         cur = cur->next;
#  432|      }
#  433|->    assert(strlen(result) == reqd_sz-1);
#  434|      // printf("(%s) result: |%s|\n", __func__, result);
#  435|      return result;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def22]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:139:4: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(devname, 524290)'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:707:13: enter_function: entry to 'probe_one_device_using_libdrm'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:761:13: acquire_resource: opened here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:762:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:767:10: branch_false: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:770:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:771:7: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:771:7: call_function: calling 'probe_open_device_using_libdrm' from 'probe_one_device_using_libdrm'
#  137|      // int errsv;
#  138|   
#  139|->    rpt_nl();
#  140|   
#  141|      DBGTRC_STARTING(debug, TRACE_GROUP, "fd=%d", fd);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def23]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:141:4: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(devname, 524290)'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:707:13: enter_function: entry to 'probe_one_device_using_libdrm'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:761:13: acquire_resource: opened here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:762:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:767:10: branch_false: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:770:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:771:7: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:771:7: call_function: calling 'probe_open_device_using_libdrm' from 'probe_one_device_using_libdrm'
#  139|      rpt_nl();
#  140|   
#  141|->    DBGTRC_STARTING(debug, TRACE_GROUP, "fd=%d", fd);
#  142|   
#  143|      // succeeds if run as root, fails w errno=EACCES(13) if not

Error: GCC_ANALYZER_WARNING (CWE-775): [#def24]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:767:10: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(devname, 524290)'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:761:13: acquire_resource: opened here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:762:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:767:10: branch_false: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_drm.c:767:10: danger: 'open(devname, 524290)' leaks here; was opened at [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0)
#  765|         }
#  766|         else
#  767|->          rpt_vstring(depth+1, "Open succeeded for device: %s", devname);
#  768|      }
#  769|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def25]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:248:13: warning[-Wanalyzer-malloc-leak]: leak of 'edid_buf'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:236:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:237:4: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:245:22: acquire_memory: allocated here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:248:13: danger: 'edid_buf' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  246|      snprintf(i2cdev, 20, "/dev/i2c-%d", busno);
#  247|      bool ok = false;
#  248|->    int fd = open(i2cdev, O_RDWR );
#  249|      if (fd < 0) {
#  250|         rpt_vstring(depth, "Open failed for %s, errno=%s", i2cdev, linux_errno_desc(errno));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def26]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:250:7: warning[-Wanalyzer-malloc-leak]: leak of 'edid_buf'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:236:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:237:4: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:245:22: acquire_memory: allocated here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:249:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:250:83: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:250:7: danger: 'edid_buf' leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#  248|      int fd = open(i2cdev, O_RDWR );
#  249|      if (fd < 0) {
#  250|->       rpt_vstring(depth, "Open failed for %s, errno=%s", i2cdev, linux_errno_desc(errno));
#  251|      }
#  252|      else {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def27]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:254:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'edid_buf'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:236:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:237:4: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:245:22: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:249:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:253:10: branch_false: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:253:10: branch_true: following 'true' branch (when 'write_before_read != 0')...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:254:10: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:254:10: danger: 'edid_buf' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/2)
#  252|      else {
#  253|         if (write_before_read) {
#  254|->          edid_buf[0] = 0x00;
#  255|            rc = i2c_ioctl_writer(fd, 0x50, 1, edid_buf);
#  256|            if (rc < 0) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def28]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:255:15: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(&i2cdev, 2)'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:236:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:237:4: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:248:13: acquire_resource: opened here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:249:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:253:10: branch_false: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:253:10: branch_true: following 'true' branch (when 'write_before_read != 0')...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:254:10: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:255:15: danger: 'open(&i2cdev, 2)' leaks here; was opened at [(3)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/2)
#  253|         if (write_before_read) {
#  254|            edid_buf[0] = 0x00;
#  255|->          rc = i2c_ioctl_writer(fd, 0x50, 1, edid_buf);
#  256|            if (rc < 0) {
#  257|               rpt_vstring(depth, "write of 1 byte failed, errno = %s", linux_errno_desc(errno));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def29]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:255:15: warning[-Wanalyzer-malloc-leak]: leak of 'edid_buf'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:236:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:237:4: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:245:22: acquire_memory: allocated here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:249:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:253:10: branch_false: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:253:10: branch_true: following 'true' branch (when 'write_before_read != 0')...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:254:10: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:255:15: danger: 'edid_buf' leaks here; was allocated at [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2)
#  253|         if (write_before_read) {
#  254|            edid_buf[0] = 0x00;
#  255|->          rc = i2c_ioctl_writer(fd, 0x50, 1, edid_buf);
#  256|            if (rc < 0) {
#  257|               rpt_vstring(depth, "write of 1 byte failed, errno = %s", linux_errno_desc(errno));

Error: GCC_ANALYZER_WARNING (CWE-775): [#def30]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:263:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(&i2cdev, 2)'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:236:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:237:4: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:248:13: acquire_resource: opened here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:249:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:253:10: branch_false: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:253:10: branch_false: following 'false' branch (when 'write_before_read == 0')...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:263:12: branch_false: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:263:12: danger: 'open(&i2cdev, 2)' leaks here; was opened at [(3)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/2)
#  261|         DBGMSF(debug, "Calling i2c_ioctl_reader(), read_bytewise=false, read_size=%d, edid_buf=%p",
#  262|                       read_size, edid_buf);
#  263|->       rc = i2c_ioctl_reader(fd, 0x50, false, read_size, edid_buf);
#  264|         if (rc < 0) {
#  265|            rpt_vstring(depth,"read failed. errno = %s", linux_errno_desc(errno));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def31]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:263:12: warning[-Wanalyzer-malloc-leak]: leak of 'edid_buf'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:236:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:237:4: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:245:22: acquire_memory: allocated here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:249:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:253:10: branch_false: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:253:10: branch_false: following 'false' branch (when 'write_before_read == 0')...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:263:12: branch_false: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_i2c.c:263:12: danger: 'edid_buf' leaks here; was allocated at [(3)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/2)
#  261|         DBGMSF(debug, "Calling i2c_ioctl_reader(), read_bytewise=false, read_size=%d, edid_buf=%p",
#  262|                       read_size, edid_buf);
#  263|->       rc = i2c_ioctl_reader(fd, 0x50, false, read_size, edid_buf);
#  264|         if (rc < 0) {
#  265|            rpt_vstring(depth,"read failed. errno = %s", linux_errno_desc(errno));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def32]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_modules.c:118:4: warning[-Wanalyzer-malloc-leak]: leak of 'cmd'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_modules.c:116:17: acquire_memory: allocated here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_modules.c:118:4: danger: 'cmd' leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  116|      char * cmd = calloc(1, bufsz);
#  117|      // g_snprintf(cmd, bufsz, "grep -El \"\(%s)\" /etc/modprobe.d/*conf | xargs tail -n +1", grep_terms );
#  118|->    g_snprintf(cmd, bufsz, "grep -EH \"\(%s)\" /etc/modprobe.d/*conf", grep_terms );
#  119|      // DBGMSG("cmd: %s", cmd);
#  120|      execute_shell_cmd_rpt(cmd, depth+1);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def33]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_procfs.c:105:24: warning[-Wanalyzer-malloc-leak]: leak of 'opendir("/proc/driver/nvidia/gpus/")'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_procfs.c:94:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_procfs.c:95:7: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_procfs.c:101:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_procfs.c:102:21: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_procfs.c:102:21: acquire_memory: allocated here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_procfs.c:105:24: danger: 'opendir("/proc/driver/nvidia/gpus/")' leaks here; was allocated at [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
#  103|            struct dirent * ep;
#  104|   
#  105|->          while ( (ep = readdir(dp)) ) {
#  106|               if ( !streq(ep->d_name,".") && !streq(ep->d_name, "..") ) {
#  107|                  rpt_vstring(1, "PCI bus id: %s", ep->d_name);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def34]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_procfs.c:105:24: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'opendir("/proc/driver/nvidia/gpus/")' where non-null expected
ddcutil-2.2.1/src/app_sysenv/query_sysenv_procfs.c:94:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_procfs.c:95:7: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_procfs.c:101:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_procfs.c:102:21: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_procfs.c:102:21: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/app_sysenv/query_sysenv_procfs.c:105:24: danger: argument 1 ('opendir("/proc/driver/nvidia/gpus/")') from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
#  103|            struct dirent * ep;
#  104|   
#  105|->          while ( (ep = readdir(dp)) ) {
#  106|               if ( !streq(ep->d_name,".") && !streq(ep->d_name, "..") ) {
#  107|                  rpt_vstring(1, "PCI bus id: %s", ep->d_name);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def35]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:630:37: warning[-Wanalyzer-malloc-leak]: leak of 'opendir("/sys/module/drm/holders/amdgpu/parameters")'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:617:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:624:19: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:624:19: acquire_memory: allocated here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:624:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:630:37: branch_false: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:630:37: danger: 'opendir("/sys/module/drm/holders/amdgpu/parameters")' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  628|         }
#  629|         else {
#  630|->          GPtrArray * sorted_names = g_ptr_array_new_with_free_func(g_free);
#  631|            while (true){
#  632|               dp = readdir(dirp);   // per man page, do not free

Error: GCC_ANALYZER_WARNING (CWE-401): [#def36]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:632:18: warning[-Wanalyzer-malloc-leak]: leak of 'opendir("/sys/module/drm/holders/amdgpu/parameters")'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:617:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:624:19: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:624:19: acquire_memory: allocated here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:624:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:630:37: branch_false: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:632:18: danger: 'opendir("/sys/module/drm/holders/amdgpu/parameters")' leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#  630|            GPtrArray * sorted_names = g_ptr_array_new_with_free_func(g_free);
#  631|            while (true){
#  632|->             dp = readdir(dirp);   // per man page, do not free
#  633|               if (!dp)
#  634|                  break;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def37]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:636:16: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(&*<unknown>.d_name)'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:617:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:624:19: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:624:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:630:37: branch_false: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:633:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:635:17: branch_false: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:635:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:636:53: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:636:46: acquire_memory: allocated here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_sysfs.c:636:16: danger: 'strdup(&*<unknown>.d_name)' leaks here; was allocated at [(9)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/8)
#  634|                  break;
#  635|               if (dp->d_type & DT_REG) {
#  636|->                g_ptr_array_add(sorted_names, strdup(dp->d_name));
#  637|               }
#  638|            }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def38]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_usb.c:86:21: warning[-Wanalyzer-malloc-leak]: leak of 'opendir("/sys/kernel/debug/hid/")'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_usb.c:80:9: acquire_memory: allocated here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_usb.c:81:7: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_usb.c:86:21: danger: 'opendir("/sys/kernel/debug/hid/")' leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   84|      }
#   85|      else {
#   86|->       while ( (ep = readdir(dp))) {
#   87|            // puts(ep->d_name);
#   88|            char fqfn[PATH_MAX];

Error: GCC_ANALYZER_WARNING (CWE-401): [#def39]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:129:12: warning[-Wanalyzer-malloc-leak]: leak of 'xref'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:140:25: enter_function: entry to 'device_xref_new'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:141:28: acquire_memory: allocated here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:144:22: call_function: calling 'device_xref_edid_tag' from 'device_xref_new'
#  127|    */
#  128|   char * device_xref_edid_tag(const Byte * raw_edid) {
#  129|->    return  hexstring2(raw_edid+124, 4, NULL, true, NULL, 0);
#  130|   }
#  131|   

Error: CPPCHECK_WARNING (CWE-476): [#def40]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:142: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: xref
#  140|   static Device_Id_Xref * device_xref_new(Byte * raw_edid) {
#  141|      Device_Id_Xref * xref = calloc(1, sizeof(Device_Id_Xref));
#  142|->    memcpy(xref->marker, DEVICE_ID_XREF_MARKER, 4);
#  143|      memcpy(xref->raw_edid, raw_edid, 128);
#  144|      xref->edid_tag =  device_xref_edid_tag(xref->raw_edid);

Error: CPPCHECK_WARNING (CWE-476): [#def41]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:143: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: xref
#  141|      Device_Id_Xref * xref = calloc(1, sizeof(Device_Id_Xref));
#  142|      memcpy(xref->marker, DEVICE_ID_XREF_MARKER, 4);
#  143|->    memcpy(xref->raw_edid, raw_edid, 128);
#  144|      xref->edid_tag =  device_xref_edid_tag(xref->raw_edid);
#  145|      xref->i2c_busno = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def42]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:144: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: xref
#  142|      memcpy(xref->marker, DEVICE_ID_XREF_MARKER, 4);
#  143|      memcpy(xref->raw_edid, raw_edid, 128);
#  144|->    xref->edid_tag =  device_xref_edid_tag(xref->raw_edid);
#  145|      xref->i2c_busno = -1;
#  146|   // #ifdef ALTERNATIVE

Error: GCC_ANALYZER_WARNING (CWE-476): [#def43]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:144:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'xref'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:141:28: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:144:4: danger: 'xref' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  142|      memcpy(xref->marker, DEVICE_ID_XREF_MARKER, 4);
#  143|      memcpy(xref->raw_edid, raw_edid, 128);
#  144|->    xref->edid_tag =  device_xref_edid_tag(xref->raw_edid);
#  145|      xref->i2c_busno = -1;
#  146|   // #ifdef ALTERNATIVE

Error: CPPCHECK_WARNING (CWE-476): [#def44]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:145: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: xref
#  143|      memcpy(xref->raw_edid, raw_edid, 128);
#  144|      xref->edid_tag =  device_xref_edid_tag(xref->raw_edid);
#  145|->    xref->i2c_busno = -1;
#  146|   // #ifdef ALTERNATIVE
#  147|      xref->sysfs_drm_busno = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def45]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:147: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: xref
#  145|      xref->i2c_busno = -1;
#  146|   // #ifdef ALTERNATIVE
#  147|->    xref->sysfs_drm_busno = -1;
#  148|   // #endif
#  149|      // DBGMSG("Created xref %p with tag: %s", xref, xref->edid_tag);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def46]
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:223:4: warning[-Wanalyzer-malloc-leak]: leak of 'device_xref_new(raw_edid)'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:210:18: enter_function: entry to 'device_xref_new_with_busno'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:211:4: branch_true: following 'true' branch (when 'busno >= 0')...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:212:4: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:212:4: branch_true: following 'true' branch (when 'raw_edid' is non-NULL)...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:217:11: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:218:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:220:11: branch_true: ...to here
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:220:11: call_function: calling 'device_xref_new' from 'device_xref_new_with_busno'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:220:11: return_function: returning to 'device_xref_new_with_busno' from 'device_xref_new'
ddcutil-2.2.1/src/app_sysenv/query_sysenv_xref.c:223:4: danger: 'device_xref_new(raw_edid)' leaks here; was allocated at [(10)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/9)
#  221|      xref->i2c_busno = busno;
#  222|      xref->udev_busno = -1;
#  223|->    g_ptr_array_add(device_xref, xref);
#  224|      DBGMSF(debug, "Created xref %p with busno %d, EDID tag: ...%s",
#  225|                    xref, xref->i2c_busno, xref->edid_tag);

Error: GCC_ANALYZER_WARNING (CWE-404): [#def47]
ddcutil-2.2.1/src/base/core.c:415:23: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
ddcutil-2.2.1/src/base/core.c:867:6: enter_function: entry to 'dbgtrc_returning_string'
ddcutil-2.2.1/src/base/core.c:892:7: acquire_resource: 'va_start' called here
ddcutil-2.2.1/src/base/core.c:896:21: call_function: calling 'vdbgtrc' from 'dbgtrc_returning_string'
#  413|      bool result = false;
#  414|      result =  (trace_group == DDCA_TRC_ALL) || (trace_levels & trace_group); // is trace_group being traced?
#  415|->    result = result || is_traced_function(funcname) || is_traced_file(filename) || trace_api_call_depth > 0;
#  416|   
#  417|      DBGF(debug, "Done.     trace_group=0x%04x, filename=%s, funcname=%s, trace_levels=0x%04x, returning %d\n",

Error: GCC_ANALYZER_WARNING (CWE-404): [#def48]
ddcutil-2.2.1/src/base/core.c:415:55: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
ddcutil-2.2.1/src/base/core.c:867:6: enter_function: entry to 'dbgtrc_returning_string'
ddcutil-2.2.1/src/base/core.c:892:7: acquire_resource: 'va_start' called here
ddcutil-2.2.1/src/base/core.c:896:21: call_function: calling 'vdbgtrc' from 'dbgtrc_returning_string'
#  413|      bool result = false;
#  414|      result =  (trace_group == DDCA_TRC_ALL) || (trace_levels & trace_group); // is trace_group being traced?
#  415|->    result = result || is_traced_function(funcname) || is_traced_file(filename) || trace_api_call_depth > 0;
#  416|   
#  417|      DBGF(debug, "Done.     trace_group=0x%04x, filename=%s, funcname=%s, trace_levels=0x%04x, returning %d\n",

Error: GCC_ANALYZER_WARNING (CWE-404): [#def49]
ddcutil-2.2.1/src/base/core.c:543:50: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
ddcutil-2.2.1/src/base/core.c:867:6: enter_function: entry to 'dbgtrc_returning_string'
ddcutil-2.2.1/src/base/core.c:892:7: acquire_resource: 'va_start' called here
ddcutil-2.2.1/src/base/core.c:896:21: call_function: calling 'vdbgtrc' from 'dbgtrc_returning_string'
#  541|   
#  542|      if (perform_emit) {
#  543|->       Thread_Output_Settings * thread_settings = get_thread_settings();
#  544|         // n. trace_group == DDCA_TRC_ALL for SEVEREMSG() or API call tracing
#  545|         if ( is_tracing(trace_group, filename, funcname)  ) {

Error: GCC_ANALYZER_WARNING (CWE-404): [#def50]
ddcutil-2.2.1/src/base/core.c:546:28: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
ddcutil-2.2.1/src/base/core.c:867:6: enter_function: entry to 'dbgtrc_returning_string'
ddcutil-2.2.1/src/base/core.c:892:7: acquire_resource: 'va_start' called here
ddcutil-2.2.1/src/base/core.c:896:21: call_function: calling 'vdbgtrc' from 'dbgtrc_returning_string'
#  544|         // n. trace_group == DDCA_TRC_ALL for SEVEREMSG() or API call tracing
#  545|         if ( is_tracing(trace_group, filename, funcname)  ) {
#  546|->          char * base_msg = g_strdup_vprintf(format, ap);
#  547|            if (debug) {
#  548|               printf("base_msg=%p->|%s|\n", base_msg, base_msg);

Error: CPPCHECK_WARNING (CWE-476): [#def51]
ddcutil-2.2.1/src/base/ddc_packets.c:264: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: packet
#  262|   
#  263|      DDC_Packet * packet = malloc(sizeof(DDC_Packet));
#  264|->    packet->raw_bytes = buffer_new(max_size, "empty DDC packet");
#  265|      if (tag) {
#  266|         strncpy(packet->tag, tag, sizeof(packet->tag));  // no need to check if packet->tag truncated

Error: GCC_ANALYZER_WARNING (CWE-476): [#def52]
ddcutil-2.2.1/src/base/ddc_packets.c:264:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'packet'
ddcutil-2.2.1/src/base/ddc_packets.c:263:26: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/ddc_packets.c:264:4: danger: 'packet' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  262|   
#  263|      DDC_Packet * packet = malloc(sizeof(DDC_Packet));
#  264|->    packet->raw_bytes = buffer_new(max_size, "empty DDC packet");
#  265|      if (tag) {
#  266|         strncpy(packet->tag, tag, sizeof(packet->tag));  // no need to check if packet->tag truncated

Error: GCC_ANALYZER_WARNING (CWE-401): [#def53]
ddcutil-2.2.1/src/base/ddc_packets.c:264:24: warning[-Wanalyzer-malloc-leak]: leak of 'packet'
ddcutil-2.2.1/src/base/ddc_packets.c:263:26: acquire_memory: allocated here
ddcutil-2.2.1/src/base/ddc_packets.c:264:24: danger: 'packet' leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  262|   
#  263|      DDC_Packet * packet = malloc(sizeof(DDC_Packet));
#  264|->    packet->raw_bytes = buffer_new(max_size, "empty DDC packet");
#  265|      if (tag) {
#  266|         strncpy(packet->tag, tag, sizeof(packet->tag));  // no need to check if packet->tag truncated

Error: CPPCHECK_WARNING (CWE-476): [#def54]
ddcutil-2.2.1/src/base/ddc_packets.c:266: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: packet
#  264|      packet->raw_bytes = buffer_new(max_size, "empty DDC packet");
#  265|      if (tag) {
#  266|->       strncpy(packet->tag, tag, sizeof(packet->tag));  // no need to check if packet->tag truncated
#  267|         packet->tag[sizeof(packet->tag)-1] = '\0';
#  268|      }

Error: CPPCHECK_WARNING (CWE-476): [#def55]
ddcutil-2.2.1/src/base/ddc_packets.c:267: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: packet
#  265|      if (tag) {
#  266|         strncpy(packet->tag, tag, sizeof(packet->tag));  // no need to check if packet->tag truncated
#  267|->       packet->tag[sizeof(packet->tag)-1] = '\0';
#  268|      }
#  269|      else

Error: CPPCHECK_WARNING (CWE-476): [#def56]
ddcutil-2.2.1/src/base/ddc_packets.c:270: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: packet
#  268|      }
#  269|      else
#  270|->       packet->tag[0] = '\0';
#  271|      // DBGMSG("packet->tag=%s", packet->tag);
#  272|      packet->type = DDC_PACKET_TYPE_NONE;

Error: CPPCHECK_WARNING (CWE-476): [#def57]
ddcutil-2.2.1/src/base/ddc_packets.c:272: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: packet
#  270|         packet->tag[0] = '\0';
#  271|      // DBGMSG("packet->tag=%s", packet->tag);
#  272|->    packet->type = DDC_PACKET_TYPE_NONE;
#  273|      packet->parsed.raw_parsed = NULL;
#  274|   

Error: CPPCHECK_WARNING (CWE-476): [#def58]
ddcutil-2.2.1/src/base/ddc_packets.c:273: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: packet
#  271|      // DBGMSG("packet->tag=%s", packet->tag);
#  272|      packet->type = DDC_PACKET_TYPE_NONE;
#  273|->    packet->parsed.raw_parsed = NULL;
#  274|   
#  275|      DBGTRC_RET_STRUCT(debug, TRACE_GROUP, DDC_Packet, dbgrpt_packet, packet);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def59]
ddcutil-2.2.1/src/base/ddc_packets.c:275:4: warning[-Wanalyzer-malloc-leak]: leak of 'packet'
ddcutil-2.2.1/src/base/ddc_packets.c:263:26: acquire_memory: allocated here
ddcutil-2.2.1/src/base/ddc_packets.c:275:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/ddc_packets.c:275:4: branch_false: ...to here
ddcutil-2.2.1/src/base/ddc_packets.c:275:4: danger: 'packet' leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  273|      packet->parsed.raw_parsed = NULL;
#  274|   
#  275|->    DBGTRC_RET_STRUCT(debug, TRACE_GROUP, DDC_Packet, dbgrpt_packet, packet);
#  276|      return packet;
#  277|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def60]
ddcutil-2.2.1/src/base/ddc_packets.c:305:4: warning[-Wanalyzer-malloc-leak]: leak of 'create_empty_ddc_packet(data_bytect + 4, tag)'
ddcutil-2.2.1/src/base/ddc_packets.c:292:1: enter_function: entry to 'create_ddc_base_request_packet'
ddcutil-2.2.1/src/base/ddc_packets.c:302:4: branch_false: following 'false' branch (when 'data_bytect <= 32')...
ddcutil-2.2.1/src/base/ddc_packets.c:304:26: branch_false: ...to here
ddcutil-2.2.1/src/base/ddc_packets.c:304:26: call_function: calling 'create_empty_ddc_packet' from 'create_ddc_base_request_packet'
ddcutil-2.2.1/src/base/ddc_packets.c:304:26: return_function: returning to 'create_ddc_base_request_packet' from 'create_empty_ddc_packet'
ddcutil-2.2.1/src/base/ddc_packets.c:305:4: danger: 'create_empty_ddc_packet(data_bytect + 4, tag)' leaks here; was allocated at [(6)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/5)
#  303|   
#  304|      DDC_Packet * packet = create_empty_ddc_packet(3+data_bytect+1, tag);
#  305|->    buffer_set_byte( packet->raw_bytes, 0, 0x6e);   // x37<<1 + 0   destination address, write
#  306|      buffer_set_byte( packet->raw_bytes, 1, source_addr);   // x28<<1 + 1   source address
#  307|      buffer_set_byte( packet->raw_bytes, 2, data_bytect | 0x80);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def61]
ddcutil-2.2.1/src/base/ddc_packets.c:306:4: warning[-Wanalyzer-malloc-leak]: leak of 'create_empty_ddc_packet(data_bytect + 4, tag)'
ddcutil-2.2.1/src/base/ddc_packets.c:292:1: enter_function: entry to 'create_ddc_base_request_packet'
ddcutil-2.2.1/src/base/ddc_packets.c:302:4: branch_false: following 'false' branch (when 'data_bytect <= 32')...
ddcutil-2.2.1/src/base/ddc_packets.c:304:26: branch_false: ...to here
ddcutil-2.2.1/src/base/ddc_packets.c:304:26: call_function: calling 'create_empty_ddc_packet' from 'create_ddc_base_request_packet'
ddcutil-2.2.1/src/base/ddc_packets.c:304:26: return_function: returning to 'create_ddc_base_request_packet' from 'create_empty_ddc_packet'
ddcutil-2.2.1/src/base/ddc_packets.c:306:4: danger: 'create_empty_ddc_packet(data_bytect + 4, tag)' leaks here; was allocated at [(6)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/5)
#  304|      DDC_Packet * packet = create_empty_ddc_packet(3+data_bytect+1, tag);
#  305|      buffer_set_byte( packet->raw_bytes, 0, 0x6e);   // x37<<1 + 0   destination address, write
#  306|->    buffer_set_byte( packet->raw_bytes, 1, source_addr);   // x28<<1 + 1   source address
#  307|      buffer_set_byte( packet->raw_bytes, 2, data_bytect | 0x80);
#  308|      buffer_set_bytes(packet->raw_bytes, 3, data_bytes, data_bytect);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def62]
ddcutil-2.2.1/src/base/ddc_packets.c:307:4: warning[-Wanalyzer-malloc-leak]: leak of 'create_empty_ddc_packet(data_bytect + 4, tag)'
ddcutil-2.2.1/src/base/ddc_packets.c:292:1: enter_function: entry to 'create_ddc_base_request_packet'
ddcutil-2.2.1/src/base/ddc_packets.c:302:4: branch_false: following 'false' branch (when 'data_bytect <= 32')...
ddcutil-2.2.1/src/base/ddc_packets.c:304:26: branch_false: ...to here
ddcutil-2.2.1/src/base/ddc_packets.c:304:26: call_function: calling 'create_empty_ddc_packet' from 'create_ddc_base_request_packet'
ddcutil-2.2.1/src/base/ddc_packets.c:304:26: return_function: returning to 'create_ddc_base_request_packet' from 'create_empty_ddc_packet'
ddcutil-2.2.1/src/base/ddc_packets.c:307:4: danger: 'create_empty_ddc_packet(data_bytect + 4, tag)' leaks here; was allocated at [(6)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/5)
#  305|      buffer_set_byte( packet->raw_bytes, 0, 0x6e);   // x37<<1 + 0   destination address, write
#  306|      buffer_set_byte( packet->raw_bytes, 1, source_addr);   // x28<<1 + 1   source address
#  307|->    buffer_set_byte( packet->raw_bytes, 2, data_bytect | 0x80);
#  308|      buffer_set_bytes(packet->raw_bytes, 3, data_bytes, data_bytect);
#  309|      int packet_size_wo_checksum = 3 + data_bytect;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def63]
ddcutil-2.2.1/src/base/ddc_packets.c:308:4: warning[-Wanalyzer-malloc-leak]: leak of 'create_empty_ddc_packet(data_bytect + 4, tag)'
ddcutil-2.2.1/src/base/ddc_packets.c:292:1: enter_function: entry to 'create_ddc_base_request_packet'
ddcutil-2.2.1/src/base/ddc_packets.c:302:4: branch_false: following 'false' branch (when 'data_bytect <= 32')...
ddcutil-2.2.1/src/base/ddc_packets.c:304:26: branch_false: ...to here
ddcutil-2.2.1/src/base/ddc_packets.c:304:26: call_function: calling 'create_empty_ddc_packet' from 'create_ddc_base_request_packet'
ddcutil-2.2.1/src/base/ddc_packets.c:304:26: return_function: returning to 'create_ddc_base_request_packet' from 'create_empty_ddc_packet'
ddcutil-2.2.1/src/base/ddc_packets.c:308:4: danger: 'create_empty_ddc_packet(data_bytect + 4, tag)' leaks here; was allocated at [(6)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/5)
#  306|      buffer_set_byte( packet->raw_bytes, 1, source_addr);   // x28<<1 + 1   source address
#  307|      buffer_set_byte( packet->raw_bytes, 2, data_bytect | 0x80);
#  308|->    buffer_set_bytes(packet->raw_bytes, 3, data_bytes, data_bytect);
#  309|      int packet_size_wo_checksum = 3 + data_bytect;
#  310|      Byte checksum = ddc_checksum(packet->raw_bytes->bytes, packet_size_wo_checksum, false);

Error: CPPCHECK_WARNING (CWE-476): [#def64]
ddcutil-2.2.1/src/base/ddc_packets.c:745: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: aux_data
#  743|   
#  744|         // DBGMSG("offset_hi_byte = 0x%02x, offset_lo_byte = 0x%02x", offset_hi_byte, offset_lo_byte );
#  745|->       aux_data->fragment_type = response_type;    // set in caller?  would make response_type parm unnecessary
#  746|         aux_data->fragment_offset = offset_hi_byte << 8 | offset_lo_byte;
#  747|         aux_data->fragment_length = read_data_length;      // changed

Error: CPPCHECK_WARNING (CWE-476): [#def65]
ddcutil-2.2.1/src/base/ddc_packets.c:746: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: aux_data
#  744|         // DBGMSG("offset_hi_byte = 0x%02x, offset_lo_byte = 0x%02x", offset_hi_byte, offset_lo_byte );
#  745|         aux_data->fragment_type = response_type;    // set in caller?  would make response_type parm unnecessary
#  746|->       aux_data->fragment_offset = offset_hi_byte << 8 | offset_lo_byte;
#  747|         aux_data->fragment_length = read_data_length;      // changed
#  748|         assert(read_data_length <= MAX_DDC_MULTI_PART_FRAGMENT_SIZE);   // ???

Error: CPPCHECK_WARNING (CWE-476): [#def66]
ddcutil-2.2.1/src/base/ddc_packets.c:747: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: aux_data
#  745|         aux_data->fragment_type = response_type;    // set in caller?  would make response_type parm unnecessary
#  746|         aux_data->fragment_offset = offset_hi_byte << 8 | offset_lo_byte;
#  747|->       aux_data->fragment_length = read_data_length;      // changed
#  748|         assert(read_data_length <= MAX_DDC_MULTI_PART_FRAGMENT_SIZE);   // ???
#  749|         memcpy(aux_data->bytes, read_data_start, read_data_length);    // CHANGED

Error: CPPCHECK_WARNING (CWE-476): [#def67]
ddcutil-2.2.1/src/base/ddc_packets.c:749: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: aux_data
#  747|         aux_data->fragment_length = read_data_length;      // changed
#  748|         assert(read_data_length <= MAX_DDC_MULTI_PART_FRAGMENT_SIZE);   // ???
#  749|->       memcpy(aux_data->bytes, read_data_start, read_data_length);    // CHANGED
#  750|         // aux_data->text[text_length] = '\0';     // CHANGED
#  751|      }

Error: CPPCHECK_WARNING (CWE-476): [#def68]
ddcutil-2.2.1/src/base/ddc_packets.c:830: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_response
#  828|      int result = DDCRC_OK;
#  829|      // set initial values for failure case:
#  830|->    memset(parsed_response, 0, sizeof(Parsed_Nontable_Vcp_Response));
#  831|      // parsed_response->vcp_code         = 0x00;
#  832|      // parsed_response->valid_response   = false;

Error: CPPCHECK_WARNING (CWE-476): [#def69]
ddcutil-2.2.1/src/base/ddc_packets.c:1192: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: copy
# 1190|         if (make_copy) {
# 1191|            Parsed_Nontable_Vcp_Response * copy = malloc(sizeof(Parsed_Nontable_Vcp_Response));
# 1192|->          memcpy(copy, packet->parsed.nontable_response, sizeof(Parsed_Nontable_Vcp_Response));
# 1193|            *interpreted_loc = copy;
# 1194|         }

Error: GCC_ANALYZER_WARNING (CWE-688): [#def70]
ddcutil-2.2.1/src/base/ddc_packets.c:1192:10: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'copy' where non-null expected
ddcutil-2.2.1/src/base/ddc_packets.c:1185:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/ddc_packets.c:1190:10: branch_false: ...to here
ddcutil-2.2.1/src/base/ddc_packets.c:1190:10: branch_true: following 'true' branch (when 'make_copy != 0')...
ddcutil-2.2.1/src/base/ddc_packets.c:1191:48: branch_true: ...to here
ddcutil-2.2.1/src/base/ddc_packets.c:1191:48: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/ddc_packets.c:1192:10: danger: argument 1 ('copy') from [(5)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
#argument 1 of '__builtin_memcpy' must be non-null
# 1190|         if (make_copy) {
# 1191|            Parsed_Nontable_Vcp_Response * copy = malloc(sizeof(Parsed_Nontable_Vcp_Response));
# 1192|->          memcpy(copy, packet->parsed.nontable_response, sizeof(Parsed_Nontable_Vcp_Response));
# 1193|            *interpreted_loc = copy;
# 1194|         }

Error: CPPCHECK_WARNING (CWE-476): [#def71]
ddcutil-2.2.1/src/base/display_lock.c:116: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_desc
#  114|   Display_Lock_Record * create_display_lock_record(DDCA_IO_Path io_path) {
#  115|      Display_Lock_Record * new_desc = calloc(1, sizeof(Display_Lock_Record));
#  116|->    memcpy(new_desc->marker, DISPLAY_LOCK_MARKER, 4);
#  117|      new_desc->io_path           = io_path;
#  118|      g_mutex_init(&new_desc->display_mutex);

Error: CPPCHECK_WARNING (CWE-476): [#def72]
ddcutil-2.2.1/src/base/display_lock.c:117: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_desc
#  115|      Display_Lock_Record * new_desc = calloc(1, sizeof(Display_Lock_Record));
#  116|      memcpy(new_desc->marker, DISPLAY_LOCK_MARKER, 4);
#  117|->    new_desc->io_path           = io_path;
#  118|      g_mutex_init(&new_desc->display_mutex);
#  119|      return new_desc;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def73]
ddcutil-2.2.1/src/base/display_lock.c:117:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'new_desc'
ddcutil-2.2.1/src/base/display_lock.c:115:37: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/display_lock.c:117:4: danger: 'new_desc' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  115|      Display_Lock_Record * new_desc = calloc(1, sizeof(Display_Lock_Record));
#  116|      memcpy(new_desc->marker, DISPLAY_LOCK_MARKER, 4);
#  117|->    new_desc->io_path           = io_path;
#  118|      g_mutex_init(&new_desc->display_mutex);
#  119|      return new_desc;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def74]
ddcutil-2.2.1/src/base/display_lock.c:118:4: warning[-Wanalyzer-malloc-leak]: leak of 'new_desc'
ddcutil-2.2.1/src/base/display_lock.c:115:37: acquire_memory: allocated here
ddcutil-2.2.1/src/base/display_lock.c:118:4: danger: 'new_desc' leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  116|      memcpy(new_desc->marker, DISPLAY_LOCK_MARKER, 4);
#  117|      new_desc->io_path           = io_path;
#  118|->    g_mutex_init(&new_desc->display_mutex);
#  119|      return new_desc;
#  120|   }

Error: CPPCHECK_WARNING (CWE-476): [#def75]
ddcutil-2.2.1/src/base/displays.c:104: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pIdent
#  102|   Display_Identifier* common_create_display_identifier(Display_Id_Type id_type) {
#  103|      Display_Identifier* pIdent = calloc(1, sizeof(Display_Identifier));
#  104|->    memcpy(pIdent->marker, DISPLAY_IDENTIFIER_MARKER, 4);
#  105|      pIdent->id_type = id_type;
#  106|      pIdent->busno  = -1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def76]
ddcutil-2.2.1/src/base/displays.c:104:11: warning[-Wanalyzer-malloc-leak]: leak of 'common_create_display_identifier(1)'
ddcutil-2.2.1/src/base/displays.c:181:21: enter_function: entry to 'create_mfg_model_sn_display_identifier'
ddcutil-2.2.1/src/base/displays.c:190:33: call_function: calling 'common_create_display_identifier' from 'create_mfg_model_sn_display_identifier'
ddcutil-2.2.1/src/base/displays.c:190:33: return_function: returning to 'create_mfg_model_sn_display_identifier' from 'common_create_display_identifier'
ddcutil-2.2.1/src/base/displays.c:191:7: branch_false: following 'false' branch (when 'mfg_id' is NULL)...
ddcutil-2.2.1/src/base/displays.c:194:7: branch_false: ...to here
ddcutil-2.2.1/src/base/displays.c:195:7: branch_false: following 'false' branch (when 'model_name' is NULL)...
ddcutil-2.2.1/src/base/displays.c:198:7: branch_false: ...to here
ddcutil-2.2.1/src/base/displays.c:199:7: branch_false: following 'false' branch (when 'serial_ascii' is NULL)...
ddcutil-2.2.1/src/base/displays.c:202:7: branch_false: ...to here
ddcutil-2.2.1/src/base/displays.c:104:11: danger: 'common_create_display_identifier(1)' leaks here; was allocated at [(4)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/3)
#  102|   Display_Identifier* common_create_display_identifier(Display_Id_Type id_type) {
#  103|      Display_Identifier* pIdent = calloc(1, sizeof(Display_Identifier));
#  104|->    memcpy(pIdent->marker, DISPLAY_IDENTIFIER_MARKER, 4);
#  105|      pIdent->id_type = id_type;
#  106|      pIdent->busno  = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def77]
ddcutil-2.2.1/src/base/displays.c:105: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pIdent
#  103|      Display_Identifier* pIdent = calloc(1, sizeof(Display_Identifier));
#  104|      memcpy(pIdent->marker, DISPLAY_IDENTIFIER_MARKER, 4);
#  105|->    pIdent->id_type = id_type;
#  106|      pIdent->busno  = -1;
#  107|      pIdent->usb_bus = -1;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def78]
ddcutil-2.2.1/src/base/displays.c:105:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'pIdent'
ddcutil-2.2.1/src/base/displays.c:103:33: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/displays.c:105:4: danger: 'pIdent' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  103|      Display_Identifier* pIdent = calloc(1, sizeof(Display_Identifier));
#  104|      memcpy(pIdent->marker, DISPLAY_IDENTIFIER_MARKER, 4);
#  105|->    pIdent->id_type = id_type;
#  106|      pIdent->busno  = -1;
#  107|      pIdent->usb_bus = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def79]
ddcutil-2.2.1/src/base/displays.c:106: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pIdent
#  104|      memcpy(pIdent->marker, DISPLAY_IDENTIFIER_MARKER, 4);
#  105|      pIdent->id_type = id_type;
#  106|->    pIdent->busno  = -1;
#  107|      pIdent->usb_bus = -1;
#  108|      pIdent->usb_device = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def80]
ddcutil-2.2.1/src/base/displays.c:107: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pIdent
#  105|      pIdent->id_type = id_type;
#  106|      pIdent->busno  = -1;
#  107|->    pIdent->usb_bus = -1;
#  108|      pIdent->usb_device = -1;
#  109|      memset(pIdent->edidbytes, '\0', 128);

Error: CPPCHECK_WARNING (CWE-476): [#def81]
ddcutil-2.2.1/src/base/displays.c:108: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pIdent
#  106|      pIdent->busno  = -1;
#  107|      pIdent->usb_bus = -1;
#  108|->    pIdent->usb_device = -1;
#  109|      memset(pIdent->edidbytes, '\0', 128);
#  110|      *pIdent->model_name = '\0';

Error: CPPCHECK_WARNING (CWE-476): [#def82]
ddcutil-2.2.1/src/base/displays.c:109: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pIdent
#  107|      pIdent->usb_bus = -1;
#  108|      pIdent->usb_device = -1;
#  109|->    memset(pIdent->edidbytes, '\0', 128);
#  110|      *pIdent->model_name = '\0';
#  111|      *pIdent->serial_ascii = '\0';

Error: CPPCHECK_WARNING (CWE-476): [#def83]
ddcutil-2.2.1/src/base/displays.c:110: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pIdent
#  108|      pIdent->usb_device = -1;
#  109|      memset(pIdent->edidbytes, '\0', 128);
#  110|->    *pIdent->model_name = '\0';
#  111|      *pIdent->serial_ascii = '\0';
#  112|      return pIdent;

Error: CPPCHECK_WARNING (CWE-476): [#def84]
ddcutil-2.2.1/src/base/displays.c:111: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pIdent
#  109|      memset(pIdent->edidbytes, '\0', 128);
#  110|      *pIdent->model_name = '\0';
#  111|->    *pIdent->serial_ascii = '\0';
#  112|      return pIdent;
#  113|   }

Error: CPPCHECK_WARNING (CWE-476): [#def85]
ddcutil-2.2.1/src/base/displays.c:341: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dsel
#  339|   Display_Selector * dsel_new() {
#  340|      Display_Selector * dsel = calloc(1, sizeof(Display_Selector));
#  341|->    memcpy(dsel->marker, DISPLAY_SELECTOR_MARKER, 4);
#  342|      dsel->dispno        = -1;
#  343|      dsel->busno         = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def86]
ddcutil-2.2.1/src/base/displays.c:342: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dsel
#  340|      Display_Selector * dsel = calloc(1, sizeof(Display_Selector));
#  341|      memcpy(dsel->marker, DISPLAY_SELECTOR_MARKER, 4);
#  342|->    dsel->dispno        = -1;
#  343|      dsel->busno         = -1;
#  344|      dsel->usb_bus       = -1;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def87]
ddcutil-2.2.1/src/base/displays.c:342:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'dsel'
ddcutil-2.2.1/src/base/displays.c:340:30: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/displays.c:342:4: danger: 'dsel' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  340|      Display_Selector * dsel = calloc(1, sizeof(Display_Selector));
#  341|      memcpy(dsel->marker, DISPLAY_SELECTOR_MARKER, 4);
#  342|->    dsel->dispno        = -1;
#  343|      dsel->busno         = -1;
#  344|      dsel->usb_bus       = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def88]
ddcutil-2.2.1/src/base/displays.c:343: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dsel
#  341|      memcpy(dsel->marker, DISPLAY_SELECTOR_MARKER, 4);
#  342|      dsel->dispno        = -1;
#  343|->    dsel->busno         = -1;
#  344|      dsel->usb_bus       = -1;
#  345|      dsel->usb_device    = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def89]
ddcutil-2.2.1/src/base/displays.c:344: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dsel
#  342|      dsel->dispno        = -1;
#  343|      dsel->busno         = -1;
#  344|->    dsel->usb_bus       = -1;
#  345|      dsel->usb_device    = -1;
#  346|      return dsel;

Error: CPPCHECK_WARNING (CWE-476): [#def90]
ddcutil-2.2.1/src/base/displays.c:345: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dsel
#  343|      dsel->busno         = -1;
#  344|      dsel->usb_bus       = -1;
#  345|->    dsel->usb_device    = -1;
#  346|      return dsel;
#  347|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def91]
ddcutil-2.2.1/src/base/displays.c:517:4: warning[-Wanalyzer-malloc-leak]: leak of 'dref'
ddcutil-2.2.1/src/base/displays.c:623:15: enter_function: entry to 'create_base_display_ref'
ddcutil-2.2.1/src/base/displays.c:625:4: call_function: calling 'dpath_repr_t' from 'create_base_display_ref'
ddcutil-2.2.1/src/base/displays.c:625:4: return_function: returning to 'create_base_display_ref' from 'dpath_repr_t'
ddcutil-2.2.1/src/base/displays.c:627:25: acquire_memory: allocated here
ddcutil-2.2.1/src/base/displays.c:630:20: call_function: calling 'next_dref_id' from 'create_base_display_ref'
#  515|   static uint next_dref_id(Display_Ref * dref) {
#  516|      bool debug = false;
#  517|->    g_mutex_lock (&max_dref_id_mutex);
#  518|      guint nextid = ++max_dref_id;
#  519|      g_mutex_unlock(&max_dref_id_mutex);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def92]
ddcutil-2.2.1/src/base/displays.c:519:4: warning[-Wanalyzer-malloc-leak]: leak of 'dref'
ddcutil-2.2.1/src/base/displays.c:623:15: enter_function: entry to 'create_base_display_ref'
ddcutil-2.2.1/src/base/displays.c:625:4: call_function: calling 'dpath_repr_t' from 'create_base_display_ref'
ddcutil-2.2.1/src/base/displays.c:625:4: return_function: returning to 'create_base_display_ref' from 'dpath_repr_t'
ddcutil-2.2.1/src/base/displays.c:627:25: acquire_memory: allocated here
ddcutil-2.2.1/src/base/displays.c:630:20: call_function: calling 'next_dref_id' from 'create_base_display_ref'
#  517|      g_mutex_lock (&max_dref_id_mutex);
#  518|      guint nextid = ++max_dref_id;
#  519|->    g_mutex_unlock(&max_dref_id_mutex);
#  520|      DBGTRC_EXECUTED(debug, DDCA_TRC_NONE, "nextid = %u", nextid);
#  521|      return nextid;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def93]
ddcutil-2.2.1/src/base/displays.c:520:4: warning[-Wanalyzer-malloc-leak]: leak of 'dref'
ddcutil-2.2.1/src/base/displays.c:623:15: enter_function: entry to 'create_base_display_ref'
ddcutil-2.2.1/src/base/displays.c:625:4: call_function: calling 'dpath_repr_t' from 'create_base_display_ref'
ddcutil-2.2.1/src/base/displays.c:625:4: return_function: returning to 'create_base_display_ref' from 'dpath_repr_t'
ddcutil-2.2.1/src/base/displays.c:627:25: acquire_memory: allocated here
ddcutil-2.2.1/src/base/displays.c:630:20: call_function: calling 'next_dref_id' from 'create_base_display_ref'
#  518|      guint nextid = ++max_dref_id;
#  519|      g_mutex_unlock(&max_dref_id_mutex);
#  520|->    DBGTRC_EXECUTED(debug, DDCA_TRC_NONE, "nextid = %u", nextid);
#  521|      return nextid;
#  522|   }

Error: CPPCHECK_WARNING (CWE-476): [#def94]
ddcutil-2.2.1/src/base/displays.c:628: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dref
#  626|   
#  627|      Display_Ref * dref = calloc(1, sizeof(Display_Ref));
#  628|->    memcpy(dref->marker, DISPLAY_REF_MARKER, 4);
#  629|      dref->io_path = io_path;
#  630|      dref->dref_id = next_dref_id(dref);

Error: CPPCHECK_WARNING (CWE-476): [#def95]
ddcutil-2.2.1/src/base/displays.c:629: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dref
#  627|      Display_Ref * dref = calloc(1, sizeof(Display_Ref));
#  628|      memcpy(dref->marker, DISPLAY_REF_MARKER, 4);
#  629|->    dref->io_path = io_path;
#  630|      dref->dref_id = next_dref_id(dref);
#  631|      dref->vcp_version_xdf = DDCA_VSPEC_UNQUERIED;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def96]
ddcutil-2.2.1/src/base/displays.c:629:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'dref'
ddcutil-2.2.1/src/base/displays.c:623:15: enter_function: entry to 'create_base_display_ref'
ddcutil-2.2.1/src/base/displays.c:625:4: call_function: calling 'dpath_repr_t' from 'create_base_display_ref'
ddcutil-2.2.1/src/base/displays.c:625:4: return_function: returning to 'create_base_display_ref' from 'dpath_repr_t'
ddcutil-2.2.1/src/base/displays.c:627:25: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/displays.c:629:4: danger: 'dref' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/6)
#  627|      Display_Ref * dref = calloc(1, sizeof(Display_Ref));
#  628|      memcpy(dref->marker, DISPLAY_REF_MARKER, 4);
#  629|->    dref->io_path = io_path;
#  630|      dref->dref_id = next_dref_id(dref);
#  631|      dref->vcp_version_xdf = DDCA_VSPEC_UNQUERIED;

Error: CPPCHECK_WARNING (CWE-476): [#def97]
ddcutil-2.2.1/src/base/displays.c:630: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dref
#  628|      memcpy(dref->marker, DISPLAY_REF_MARKER, 4);
#  629|      dref->io_path = io_path;
#  630|->    dref->dref_id = next_dref_id(dref);
#  631|      dref->vcp_version_xdf = DDCA_VSPEC_UNQUERIED;
#  632|      dref->vcp_version_cmdline = DDCA_VSPEC_UNQUERIED;

Error: CPPCHECK_WARNING (CWE-476): [#def98]
ddcutil-2.2.1/src/base/displays.c:631: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dref
#  629|      dref->io_path = io_path;
#  630|      dref->dref_id = next_dref_id(dref);
#  631|->    dref->vcp_version_xdf = DDCA_VSPEC_UNQUERIED;
#  632|      dref->vcp_version_cmdline = DDCA_VSPEC_UNQUERIED;
#  633|      dref->creation_timestamp = cur_realtime_nanosec();

Error: CPPCHECK_WARNING (CWE-476): [#def99]
ddcutil-2.2.1/src/base/displays.c:632: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dref
#  630|      dref->dref_id = next_dref_id(dref);
#  631|      dref->vcp_version_xdf = DDCA_VSPEC_UNQUERIED;
#  632|->    dref->vcp_version_cmdline = DDCA_VSPEC_UNQUERIED;
#  633|      dref->creation_timestamp = cur_realtime_nanosec();
#  634|      // Per_Display_Data * pdd = pdd_get_per_display_data(io_path, true);

Error: CPPCHECK_WARNING (CWE-476): [#def100]
ddcutil-2.2.1/src/base/displays.c:633: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dref
#  631|      dref->vcp_version_xdf = DDCA_VSPEC_UNQUERIED;
#  632|      dref->vcp_version_cmdline = DDCA_VSPEC_UNQUERIED;
#  633|->    dref->creation_timestamp = cur_realtime_nanosec();
#  634|      // Per_Display_Data * pdd = pdd_get_per_display_data(io_path, true);
#  635|      // dref->pdd = pdd;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def101]
ddcutil-2.2.1/src/base/displays.c:633:31: warning[-Wanalyzer-malloc-leak]: leak of 'dref'
ddcutil-2.2.1/src/base/displays.c:623:15: enter_function: entry to 'create_base_display_ref'
ddcutil-2.2.1/src/base/displays.c:625:4: call_function: calling 'dpath_repr_t' from 'create_base_display_ref'
ddcutil-2.2.1/src/base/displays.c:625:4: return_function: returning to 'create_base_display_ref' from 'dpath_repr_t'
ddcutil-2.2.1/src/base/displays.c:627:25: acquire_memory: allocated here
ddcutil-2.2.1/src/base/displays.c:633:31: danger: 'dref' leaks here; was allocated at [(7)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/6)
#  631|      dref->vcp_version_xdf = DDCA_VSPEC_UNQUERIED;
#  632|      dref->vcp_version_cmdline = DDCA_VSPEC_UNQUERIED;
#  633|->    dref->creation_timestamp = cur_realtime_nanosec();
#  634|      // Per_Display_Data * pdd = pdd_get_per_display_data(io_path, true);
#  635|      // dref->pdd = pdd;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def102]
ddcutil-2.2.1/src/base/displays.c:636:4: warning[-Wanalyzer-malloc-leak]: leak of 'dref'
ddcutil-2.2.1/src/base/displays.c:623:15: enter_function: entry to 'create_base_display_ref'
ddcutil-2.2.1/src/base/displays.c:625:4: call_function: calling 'dpath_repr_t' from 'create_base_display_ref'
ddcutil-2.2.1/src/base/displays.c:625:4: return_function: returning to 'create_base_display_ref' from 'dpath_repr_t'
ddcutil-2.2.1/src/base/displays.c:627:25: acquire_memory: allocated here
ddcutil-2.2.1/src/base/displays.c:636:4: danger: 'dref' leaks here; was allocated at [(7)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/6)
#  634|      // Per_Display_Data * pdd = pdd_get_per_display_data(io_path, true);
#  635|      // dref->pdd = pdd;
#  636|->    g_mutex_init(&dref->access_mutex);
#  637|   
#  638|      // DBGTRC_RET_STRUCT(debug, DDCA_TRC_BASE, "Display_Ref", dbgrpt_display_ref, dref);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def103]
ddcutil-2.2.1/src/base/displays.c:912:4: warning[-Wanalyzer-malloc-leak]: leak of 'dh'
ddcutil-2.2.1/src/base/displays.c:1238:18: enter_function: entry to 'create_base_display_handle'
ddcutil-2.2.1/src/base/displays.c:1243:26: acquire_memory: allocated here
ddcutil-2.2.1/src/base/displays.c:1247:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/displays.c:1254:12: branch_false: ...to here
ddcutil-2.2.1/src/base/displays.c:1254:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/displays.c:1265:7: branch_false: ...to here
ddcutil-2.2.1/src/base/displays.c:1266:7: call_function: calling 'dbgrpt_display_ref' from 'create_base_display_handle'
#  910|   void dbgrpt_display_ref(Display_Ref * dref, bool include_businfo, int depth) {
#  911|      bool debug = false;
#  912|->    DBGTRC_STARTING(debug, DDCA_TRC_NONE, "dref=%s", dref_repr_t(dref));
#  913|      int d1 = depth+1;
#  914|      int d2 = depth+2;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def104]
ddcutil-2.2.1/src/base/displays.c:1010:17: warning[-Wanalyzer-malloc-leak]: leak of 'dh'
ddcutil-2.2.1/src/base/displays.c:1238:18: enter_function: entry to 'create_base_display_handle'
ddcutil-2.2.1/src/base/displays.c:1243:26: acquire_memory: allocated here
ddcutil-2.2.1/src/base/displays.c:1247:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/displays.c:1254:12: branch_false: ...to here
ddcutil-2.2.1/src/base/displays.c:1254:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/displays.c:1265:7: branch_false: ...to here
ddcutil-2.2.1/src/base/displays.c:1266:7: call_function: calling 'dbgrpt_display_ref' from 'create_base_display_handle'
# 1008|      static GPrivate  dref_repr_key = G_PRIVATE_INIT(g_free);
# 1009|   
# 1010|->    char * buf = get_thread_fixed_buffer(&dref_repr_key, 100);
# 1011|      if (dref)
# 1012|   #ifdef WITH_ADDR

Error: CPPCHECK_WARNING (CWE-476): [#def105]
ddcutil-2.2.1/src/base/displays.c:1244: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dh
# 1242|         dbgrpt_display_ref(dref, false,  1);
# 1243|      Display_Handle * dh = calloc(1, sizeof(Display_Handle));
# 1244|->    memcpy(dh->marker, DISPLAY_HANDLE_MARKER, 4);
# 1245|      dh->fd = fd;
# 1246|      dh->dref = dref;

Error: CPPCHECK_WARNING (CWE-476): [#def106]
ddcutil-2.2.1/src/base/displays.c:1245: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dh
# 1243|      Display_Handle * dh = calloc(1, sizeof(Display_Handle));
# 1244|      memcpy(dh->marker, DISPLAY_HANDLE_MARKER, 4);
# 1245|->    dh->fd = fd;
# 1246|      dh->dref = dref;
# 1247|      if (dref->io_path.io_mode == DDCA_IO_I2C) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def107]
ddcutil-2.2.1/src/base/displays.c:1245:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'dh'
ddcutil-2.2.1/src/base/displays.c:1243:26: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/displays.c:1245:4: danger: 'dh' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/0)
# 1243|      Display_Handle * dh = calloc(1, sizeof(Display_Handle));
# 1244|      memcpy(dh->marker, DISPLAY_HANDLE_MARKER, 4);
# 1245|->    dh->fd = fd;
# 1246|      dh->dref = dref;
# 1247|      if (dref->io_path.io_mode == DDCA_IO_I2C) {

Error: CPPCHECK_WARNING (CWE-476): [#def108]
ddcutil-2.2.1/src/base/displays.c:1246: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dh
# 1244|      memcpy(dh->marker, DISPLAY_HANDLE_MARKER, 4);
# 1245|      dh->fd = fd;
# 1246|->    dh->dref = dref;
# 1247|      if (dref->io_path.io_mode == DDCA_IO_I2C) {
# 1248|         dh->repr = g_strdup_printf("Display_Handle[i2c-%d: fd=%d]",

Error: GCC_ANALYZER_WARNING (CWE-401): [#def109]
ddcutil-2.2.1/src/base/displays.c:1248:18: warning[-Wanalyzer-malloc-leak]: leak of 'dh'
ddcutil-2.2.1/src/base/displays.c:1243:26: acquire_memory: allocated here
ddcutil-2.2.1/src/base/displays.c:1247:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/displays.c:1248:18: branch_true: ...to here
ddcutil-2.2.1/src/base/displays.c:1248:18: danger: 'dh' leaks here; was allocated at [(1)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/0)
# 1246|      dh->dref = dref;
# 1247|      if (dref->io_path.io_mode == DDCA_IO_I2C) {
# 1248|->       dh->repr = g_strdup_printf("Display_Handle[i2c-%d: fd=%d]",
# 1249|                             dh->dref->io_path.path.i2c_busno, dh->fd);
# 1250|         dh->repr_p = g_strdup_printf("Display_Handle[i2c-%d: fd=%d @%p]",

Error: GCC_ANALYZER_WARNING (CWE-401): [#def110]
ddcutil-2.2.1/src/base/displays.c:1250:20: warning[-Wanalyzer-malloc-leak]: leak of 'dh'
ddcutil-2.2.1/src/base/displays.c:1243:26: acquire_memory: allocated here
ddcutil-2.2.1/src/base/displays.c:1247:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/displays.c:1248:18: branch_true: ...to here
ddcutil-2.2.1/src/base/displays.c:1250:20: danger: 'dh' leaks here; was allocated at [(1)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/0)
# 1248|         dh->repr = g_strdup_printf("Display_Handle[i2c-%d: fd=%d]",
# 1249|                             dh->dref->io_path.path.i2c_busno, dh->fd);
# 1250|->       dh->repr_p = g_strdup_printf("Display_Handle[i2c-%d: fd=%d @%p]",
# 1251|                             dh->dref->io_path.path.i2c_busno, dh->fd, (void*)dh);
# 1252|      }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def111]
ddcutil-2.2.1/src/base/displays.c:1255:18: warning[-Wanalyzer-malloc-leak]: leak of 'dh'
ddcutil-2.2.1/src/base/displays.c:1243:26: acquire_memory: allocated here
ddcutil-2.2.1/src/base/displays.c:1247:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/displays.c:1254:12: branch_false: ...to here
ddcutil-2.2.1/src/base/displays.c:1254:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/displays.c:1255:18: branch_true: ...to here
ddcutil-2.2.1/src/base/displays.c:1255:18: danger: 'dh' leaks here; was allocated at [(1)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/0)
# 1253|   #ifdef ENABLE_USB
# 1254|      else if (dref->io_path.io_mode == DDCA_IO_USB) {
# 1255|->       dh->repr = g_strdup_printf(
# 1256|                   "Display_Handle[usb: %d:%d, %s/hiddev%d @%p]",
# 1257|                   // "Display_Handle[usb: %d:%d, %s/hiddev%d]",

Error: GCC_ANALYZER_WARNING (CWE-401): [#def112]
ddcutil-2.2.1/src/base/displays.c:1265:7: warning[-Wanalyzer-malloc-leak]: leak of 'dh'
ddcutil-2.2.1/src/base/displays.c:1243:26: acquire_memory: allocated here
ddcutil-2.2.1/src/base/displays.c:1247:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/displays.c:1254:12: branch_false: ...to here
ddcutil-2.2.1/src/base/displays.c:1254:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/displays.c:1265:7: branch_false: ...to here
ddcutil-2.2.1/src/base/displays.c:1265:7: danger: 'dh' leaks here; was allocated at [(1)](sarif:/runs/0/results/16/codeFlows/0/threadFlows/0/locations/0)
# 1263|      else {
# 1264|         // DDCA_IO_USB if !ENABLE_USB
# 1265|->       PROGRAM_LOGIC_ERROR("Unimplemented io_mode = %d", dref->io_path.io_mode);
# 1266|         dbgrpt_display_ref(dref, false,  1);
# 1267|         dh->repr = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def113]
ddcutil-2.2.1/src/base/drm_connector_state.c:155: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: meta
#  153|       assert(prop);
#  154|       Enum_Metadata * meta = calloc(1, sizeof(Enum_Metadata));
#  155|->     meta->name = strdup(prop->name);
#  156|   
#  157|       DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "prop->name = %s", prop->name);

Error: CPPCHECK_WARNING (CWE-476): [#def114]
ddcutil-2.2.1/src/base/drm_connector_state.c:160: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: meta
#  158|       DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "prop->count_enums = %d", prop->count_enums);
#  159|       DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "prop->count_values = %d", prop->count_values);
#  160|->     meta->count = prop->count_enums;
#  161|       meta->values = calloc(prop->count_enums, sizeof(uint64_t));
#  162|       meta->value_names = calloc(prop->count_enums, sizeof(char*));

Error: CPPCHECK_WARNING (CWE-476): [#def115]
ddcutil-2.2.1/src/base/drm_connector_state.c:161: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: meta
#  159|       DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "prop->count_values = %d", prop->count_values);
#  160|       meta->count = prop->count_enums;
#  161|->     meta->values = calloc(prop->count_enums, sizeof(uint64_t));
#  162|       meta->value_names = calloc(prop->count_enums, sizeof(char*));
#  163|       for (int ndx = 0; ndx < meta->count; ndx++) {

Error: CPPCHECK_WARNING (CWE-476): [#def116]
ddcutil-2.2.1/src/base/drm_connector_state.c:162: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: meta
#  160|       meta->count = prop->count_enums;
#  161|       meta->values = calloc(prop->count_enums, sizeof(uint64_t));
#  162|->     meta->value_names = calloc(prop->count_enums, sizeof(char*));
#  163|       for (int ndx = 0; ndx < meta->count; ndx++) {
#  164|          DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "prop->enums[%d].name = %s", ndx, prop->enums[ndx].name);

Error: CPPCHECK_WARNING (CWE-476): [#def117]
ddcutil-2.2.1/src/base/drm_connector_state.c:163: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: meta
#  161|       meta->values = calloc(prop->count_enums, sizeof(uint64_t));
#  162|       meta->value_names = calloc(prop->count_enums, sizeof(char*));
#  163|->     for (int ndx = 0; ndx < meta->count; ndx++) {
#  164|          DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "prop->enums[%d].name = %s", ndx, prop->enums[ndx].name);
#  165|          meta->values[ndx] = prop->enums[ndx].value;

Error: CPPCHECK_WARNING (CWE-476): [#def118]
ddcutil-2.2.1/src/base/drm_connector_state.c:165: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: meta
#  163|       for (int ndx = 0; ndx < meta->count; ndx++) {
#  164|          DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "prop->enums[%d].name = %s", ndx, prop->enums[ndx].name);
#  165|->        meta->values[ndx] = prop->enums[ndx].value;
#  166|          meta->value_names[ndx] = strdup(prop->enums[ndx].name);
#  167|       }

Error: CPPCHECK_WARNING (CWE-476): [#def119]
ddcutil-2.2.1/src/base/drm_connector_state.c:166: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: meta
#  164|          DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "prop->enums[%d].name = %s", ndx, prop->enums[ndx].name);
#  165|          meta->values[ndx] = prop->enums[ndx].value;
#  166|->        meta->value_names[ndx] = strdup(prop->enums[ndx].name);
#  167|       }
#  168|       DBGTRC_RET_STRUCT(debug, TRACE_GROUP, "Enum_Metadata", dbgrpt_enum_metadata, meta);

Error: CPPCHECK_WARNING (CWE-476): [#def120]
ddcutil-2.2.1/src/base/drm_connector_state.c:289: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: connector_state
#  287|              report_drmModeConnector(fd, conn, d1) ;
#  288|            Drm_Connector_State * connector_state = calloc(1,sizeof(Drm_Connector_State));
#  289|->          connector_state->cardno       = cardno;
#  290|            connector_state->connector_id = res->connectors[i];
#  291|            if (debug) {

Error: CPPCHECK_WARNING (CWE-476): [#def121]
ddcutil-2.2.1/src/base/drm_connector_state.c:290: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: connector_state
#  288|            Drm_Connector_State * connector_state = calloc(1,sizeof(Drm_Connector_State));
#  289|            connector_state->cardno       = cardno;
#  290|->          connector_state->connector_id = res->connectors[i];
#  291|            if (debug) {
#  292|               int depth=2;

Error: CPPCHECK_WARNING (CWE-476): [#def122]
ddcutil-2.2.1/src/base/drm_connector_state.c:299: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: connector_state
#  297|               rpt_vstring(d1, "%-20s %d - %s",  "connection:",        conn->connection, connector_status_name(conn->connection));
#  298|            }
#  299|->          connector_state->connector_type = conn->connector_type;;
#  300|            connector_state->connector_type_id = conn->connector_type_id;
#  301|            connector_state->connection = conn->connection;

Error: CPPCHECK_WARNING (CWE-476): [#def123]
ddcutil-2.2.1/src/base/drm_connector_state.c:300: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: connector_state
#  298|            }
#  299|            connector_state->connector_type = conn->connector_type;;
#  300|->          connector_state->connector_type_id = conn->connector_type_id;
#  301|            connector_state->connection = conn->connection;
#  302|            drmModeConnector * p = conn;

Error: CPPCHECK_WARNING (CWE-476): [#def124]
ddcutil-2.2.1/src/base/drm_connector_state.c:301: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: connector_state
#  299|            connector_state->connector_type = conn->connector_type;;
#  300|            connector_state->connector_type_id = conn->connector_type_id;
#  301|->          connector_state->connection = conn->connection;
#  302|            drmModeConnector * p = conn;
#  303|            if (debug)

Error: CPPCHECK_WARNING (CWE-476): [#def125]
ddcutil-2.2.1/src/base/dsa2.c:165: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cirb
#  163|   cirb_new(int size) {
#  164|      Circular_Invocation_Result_Buffer * cirb = calloc(1, sizeof(Circular_Invocation_Result_Buffer));
#  165|->    cirb->values = calloc(size, sizeof(Successful_Invocation));
#  166|      cirb->size = size;
#  167|      cirb->ct = 0;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def126]
ddcutil-2.2.1/src/base/dsa2.c:165:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cirb'
ddcutil-2.2.1/src/base/dsa2.c:164:47: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/dsa2.c:165:4: danger: 'cirb' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  163|   cirb_new(int size) {
#  164|      Circular_Invocation_Result_Buffer * cirb = calloc(1, sizeof(Circular_Invocation_Result_Buffer));
#  165|->    cirb->values = calloc(size, sizeof(Successful_Invocation));
#  166|      cirb->size = size;
#  167|      cirb->ct = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def127]
ddcutil-2.2.1/src/base/dsa2.c:166: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cirb
#  164|      Circular_Invocation_Result_Buffer * cirb = calloc(1, sizeof(Circular_Invocation_Result_Buffer));
#  165|      cirb->values = calloc(size, sizeof(Successful_Invocation));
#  166|->    cirb->size = size;
#  167|      cirb->ct = 0;
#  168|      cirb->nextpos = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def128]
ddcutil-2.2.1/src/base/dsa2.c:167: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cirb
#  165|      cirb->values = calloc(size, sizeof(Successful_Invocation));
#  166|      cirb->size = size;
#  167|->    cirb->ct = 0;
#  168|      cirb->nextpos = 0;
#  169|      return cirb;

Error: CPPCHECK_WARNING (CWE-476): [#def129]
ddcutil-2.2.1/src/base/dsa2.c:168: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cirb
#  166|      cirb->size = size;
#  167|      cirb->ct = 0;
#  168|->    cirb->nextpos = 0;
#  169|      return cirb;
#  170|   }

Error: CPPCHECK_WARNING (CWE-476): [#def130]
ddcutil-2.2.1/src/base/dsa2.c:407: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtable
#  405|   Results_Table * new_results_table(int busno) {
#  406|      Results_Table * rtable = calloc(1, sizeof(Results_Table));
#  407|->    rtable->busno = busno;
#  408|      rtable->initial_step = initial_step;
#  409|      rtable->cur_step = initial_step;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def131]
ddcutil-2.2.1/src/base/dsa2.c:407:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'rtable'
ddcutil-2.2.1/src/base/dsa2.c:406:29: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/dsa2.c:407:4: danger: 'rtable' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  405|   Results_Table * new_results_table(int busno) {
#  406|      Results_Table * rtable = calloc(1, sizeof(Results_Table));
#  407|->    rtable->busno = busno;
#  408|      rtable->initial_step = initial_step;
#  409|      rtable->cur_step = initial_step;

Error: CPPCHECK_WARNING (CWE-476): [#def132]
ddcutil-2.2.1/src/base/dsa2.c:408: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtable
#  406|      Results_Table * rtable = calloc(1, sizeof(Results_Table));
#  407|      rtable->busno = busno;
#  408|->    rtable->initial_step = initial_step;
#  409|      rtable->cur_step = initial_step;
#  410|      rtable->cur_lookback = global_lookback;

Error: CPPCHECK_WARNING (CWE-476): [#def133]
ddcutil-2.2.1/src/base/dsa2.c:409: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtable
#  407|      rtable->busno = busno;
#  408|      rtable->initial_step = initial_step;
#  409|->    rtable->cur_step = initial_step;
#  410|      rtable->cur_lookback = global_lookback;
#  411|      rtable->recent_values = cirb_new(Max_Recent_Values);

Error: CPPCHECK_WARNING (CWE-476): [#def134]
ddcutil-2.2.1/src/base/dsa2.c:410: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtable
#  408|      rtable->initial_step = initial_step;
#  409|      rtable->cur_step = initial_step;
#  410|->    rtable->cur_lookback = global_lookback;
#  411|      rtable->recent_values = cirb_new(Max_Recent_Values);
#  412|      rtable->remaining_interval = Default_Interval;

Error: CPPCHECK_WARNING (CWE-476): [#def135]
ddcutil-2.2.1/src/base/dsa2.c:411: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtable
#  409|      rtable->cur_step = initial_step;
#  410|      rtable->cur_lookback = global_lookback;
#  411|->    rtable->recent_values = cirb_new(Max_Recent_Values);
#  412|      rtable->remaining_interval = Default_Interval;
#  413|      // rtable->min_ok_step = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def136]
ddcutil-2.2.1/src/base/dsa2.c:412: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtable
#  410|      rtable->cur_lookback = global_lookback;
#  411|      rtable->recent_values = cirb_new(Max_Recent_Values);
#  412|->    rtable->remaining_interval = Default_Interval;
#  413|      // rtable->min_ok_step = 0;
#  414|      // rtable->found_failure_step = false;

Error: CPPCHECK_WARNING (CWE-476): [#def137]
ddcutil-2.2.1/src/base/dsa2.c:415: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtable
#  413|      // rtable->min_ok_step = 0;
#  414|      // rtable->found_failure_step = false;
#  415|->    rtable->state = 0x00;
#  416|      rtable->initial_lookback = rtable->cur_lookback;
#  417|      rtable->highest_step_complete_loop_failure = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def138]
ddcutil-2.2.1/src/base/dsa2.c:416: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtable
#  414|      // rtable->found_failure_step = false;
#  415|      rtable->state = 0x00;
#  416|->    rtable->initial_lookback = rtable->cur_lookback;
#  417|      rtable->highest_step_complete_loop_failure = -1;
#  418|      rtable->null_msg_max_step_for_success = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def139]
ddcutil-2.2.1/src/base/dsa2.c:417: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtable
#  415|      rtable->state = 0x00;
#  416|      rtable->initial_lookback = rtable->cur_lookback;
#  417|->    rtable->highest_step_complete_loop_failure = -1;
#  418|      rtable->null_msg_max_step_for_success = -1;
#  419|      return rtable;

Error: CPPCHECK_WARNING (CWE-476): [#def140]
ddcutil-2.2.1/src/base/dsa2.c:418: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rtable
#  416|      rtable->initial_lookback = rtable->cur_lookback;
#  417|      rtable->highest_step_complete_loop_failure = -1;
#  418|->    rtable->null_msg_max_step_for_success = -1;
#  419|      return rtable;
#  420|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def141]
ddcutil-2.2.1/src/base/dsa2.c:1244:7: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(&buffer)'
ddcutil-2.2.1/src/base/dsa2.c:1243:7: branch_true: following 'true' branch (when 'errmsgs' is non-NULL)...
ddcutil-2.2.1/src/base/dsa2.c:1244:32: branch_true: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1244:32: acquire_memory: allocated here
ddcutil-2.2.1/src/base/dsa2.c:1244:7: danger: 'strdup(&buffer)' leaks here; was allocated at [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
# 1242|      vsnprintf(buffer, sizeof(buffer), format, args);
# 1243|      if (errmsgs)
# 1244|->       g_ptr_array_add(errmsgs, strdup(buffer));
# 1245|      // DBGMSG(buffer);
# 1246|      va_end(args);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def142]
ddcutil-2.2.1/src/base/dsa2.c:1360:21: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/base/dsa2.c:1293:1: enter_function: entry to 'dsa2_restore_persistent_stats'
ddcutil-2.2.1/src/base/dsa2.c:1298:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/dsa2.c:1305:28: branch_false: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1307:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/dsa2.c:1310:26: branch_false: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1311:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/dsa2.c:1316:7: branch_false: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1316:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/dsa2.c:1320:28: branch_false: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1322:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/dsa2.c:1328:11: branch_true: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1331:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/dsa2.c:1331:15: branch_true: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1331:8: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1337:26: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/dsa2.c:1338:25: branch_true: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1340:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/dsa2.c:1352:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/dsa2.c:1353:21: branch_true: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1354:22: call_function: calling 'new_results_table' from 'dsa2_restore_persistent_stats'
ddcutil-2.2.1/src/base/dsa2.c:1354:22: return_function: returning to 'dsa2_restore_persistent_stats' from 'new_results_table'
ddcutil-2.2.1/src/base/dsa2.c:1358:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/dsa2.c:1360:15: branch_false: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1360:15: branch_true: following 'true' branch (when 'ok != 0')...
ddcutil-2.2.1/src/base/dsa2.c:1360:21: branch_true: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1360:21: danger: '<unknown>' leaks here; was allocated at [(26)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/25)
# 1358|            assert(!ok || rtable);
# 1359|   
# 1360|->          ok = ok && any_one_byte_hex_string_to_byte_in_buf(pieces[fieldndx++], &rtable->edid_checksum_byte);  // field 1
# 1361|   
# 1362|            ok = ok && str_to_int(pieces[fieldndx++], &rtable->cur_step, 10);  // field 2

Error: GCC_ANALYZER_WARNING (CWE-401): [#def143]
ddcutil-2.2.1/src/base/dsa2.c:1360:21: warning[-Wanalyzer-malloc-leak]: leak of 'rtable'
ddcutil-2.2.1/src/base/dsa2.c:1293:1: enter_function: entry to 'dsa2_restore_persistent_stats'
ddcutil-2.2.1/src/base/dsa2.c:1298:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/dsa2.c:1305:28: branch_false: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1307:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/dsa2.c:1310:26: branch_false: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1311:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/dsa2.c:1316:7: branch_false: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1316:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/dsa2.c:1320:28: branch_false: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1322:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/dsa2.c:1328:11: branch_true: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1331:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/dsa2.c:1331:15: branch_true: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1331:8: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1337:26: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/dsa2.c:1338:25: branch_true: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1340:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/dsa2.c:1352:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/dsa2.c:1353:21: branch_true: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1354:22: call_function: calling 'new_results_table' from 'dsa2_restore_persistent_stats'
ddcutil-2.2.1/src/base/dsa2.c:1354:22: return_function: returning to 'dsa2_restore_persistent_stats' from 'new_results_table'
ddcutil-2.2.1/src/base/dsa2.c:1358:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/dsa2.c:1360:15: branch_false: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1360:15: branch_true: following 'true' branch (when 'ok != 0')...
ddcutil-2.2.1/src/base/dsa2.c:1360:21: branch_true: ...to here
ddcutil-2.2.1/src/base/dsa2.c:1360:21: danger: 'rtable' leaks here; was allocated at [(24)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/23)
# 1358|            assert(!ok || rtable);
# 1359|   
# 1360|->          ok = ok && any_one_byte_hex_string_to_byte_in_buf(pieces[fieldndx++], &rtable->edid_checksum_byte);  // field 1
# 1361|   
# 1362|            ok = ok && str_to_int(pieces[fieldndx++], &rtable->cur_step, 10);  // field 2

Error: CPPCHECK_WARNING (CWE-476): [#def144]
ddcutil-2.2.1/src/base/dynamic_features.c:245: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frec
#  243|   
#  244|      Dynamic_Features_Rec * frec = calloc(1, sizeof(Dynamic_Features_Rec));
#  245|->    memcpy(frec->marker, DYNAMIC_FEATURES_REC_MARKER, 4);
#  246|   
#  247|      frec->mfg_id       = g_strdup(mfg_id);

Error: CPPCHECK_WARNING (CWE-476): [#def145]
ddcutil-2.2.1/src/base/dynamic_features.c:247: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frec
#  245|      memcpy(frec->marker, DYNAMIC_FEATURES_REC_MARKER, 4);
#  246|   
#  247|->    frec->mfg_id       = g_strdup(mfg_id);
#  248|      frec->model_name   = g_strdup(model_name);
#  249|      frec->product_code = product_code;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def146]
ddcutil-2.2.1/src/base/dynamic_features.c:247:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'frec'
ddcutil-2.2.1/src/base/dynamic_features.c:231:1: enter_function: entry to 'dfr_new'
ddcutil-2.2.1/src/base/dynamic_features.c:241:4: branch_false: following 'false' branch (when 'mfg_id' is non-NULL)...
ddcutil-2.2.1/src/base/dynamic_features.c:242:4: branch_false: ...to here
ddcutil-2.2.1/src/base/dynamic_features.c:242:4: branch_false: following 'false' branch (when 'model_name' is non-NULL)...
ddcutil-2.2.1/src/base/dynamic_features.c:244:34: branch_false: ...to here
ddcutil-2.2.1/src/base/dynamic_features.c:244:34: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/dynamic_features.c:247:25: call_function: inlined call to 'g_strdup_inline' from 'dfr_new'
ddcutil-2.2.1/src/base/dynamic_features.c:247:4: danger: 'frec' could be NULL: unchecked value from [(6)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/5)
#  245|      memcpy(frec->marker, DYNAMIC_FEATURES_REC_MARKER, 4);
#  246|   
#  247|->    frec->mfg_id       = g_strdup(mfg_id);
#  248|      frec->model_name   = g_strdup(model_name);
#  249|      frec->product_code = product_code;

Error: CPPCHECK_WARNING (CWE-476): [#def147]
ddcutil-2.2.1/src/base/dynamic_features.c:248: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frec
#  246|   
#  247|      frec->mfg_id       = g_strdup(mfg_id);
#  248|->    frec->model_name   = g_strdup(model_name);
#  249|      frec->product_code = product_code;
#  250|      frec->vspec        = DDCA_VSPEC_UNKNOWN;   // redundant, since set by calloc(), but be explicit

Error: CPPCHECK_WARNING (CWE-476): [#def148]
ddcutil-2.2.1/src/base/dynamic_features.c:249: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frec
#  247|      frec->mfg_id       = g_strdup(mfg_id);
#  248|      frec->model_name   = g_strdup(model_name);
#  249|->    frec->product_code = product_code;
#  250|      frec->vspec        = DDCA_VSPEC_UNKNOWN;   // redundant, since set by calloc(), but be explicit
#  251|      if (filename)

Error: CPPCHECK_WARNING (CWE-476): [#def149]
ddcutil-2.2.1/src/base/dynamic_features.c:250: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frec
#  248|      frec->model_name   = g_strdup(model_name);
#  249|      frec->product_code = product_code;
#  250|->    frec->vspec        = DDCA_VSPEC_UNKNOWN;   // redundant, since set by calloc(), but be explicit
#  251|      if (filename)
#  252|         frec->filename  = g_strdup(filename);

Error: CPPCHECK_WARNING (CWE-476): [#def150]
ddcutil-2.2.1/src/base/dynamic_features.c:252: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: frec
#  250|      frec->vspec        = DDCA_VSPEC_UNKNOWN;   // redundant, since set by calloc(), but be explicit
#  251|      if (filename)
#  252|->       frec->filename  = g_strdup(filename);
#  253|   
#  254|      DBGTRC_DONE(debug, TRACE_GROUP, "Returning %p", frec);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def151]
ddcutil-2.2.1/src/base/dynamic_features.c:254:4: warning[-Wanalyzer-malloc-leak]: leak of 'frec'
ddcutil-2.2.1/src/base/dynamic_features.c:231:1: enter_function: entry to 'dfr_new'
ddcutil-2.2.1/src/base/dynamic_features.c:241:4: branch_false: following 'false' branch (when 'mfg_id' is non-NULL)...
ddcutil-2.2.1/src/base/dynamic_features.c:242:4: branch_false: ...to here
ddcutil-2.2.1/src/base/dynamic_features.c:242:4: branch_false: following 'false' branch (when 'model_name' is non-NULL)...
ddcutil-2.2.1/src/base/dynamic_features.c:244:34: branch_false: ...to here
ddcutil-2.2.1/src/base/dynamic_features.c:244:34: acquire_memory: allocated here
ddcutil-2.2.1/src/base/dynamic_features.c:247:25: call_function: inlined call to 'g_strdup_inline' from 'dfr_new'
ddcutil-2.2.1/src/base/dynamic_features.c:248:25: call_function: inlined call to 'g_strdup_inline' from 'dfr_new'
ddcutil-2.2.1/src/base/dynamic_features.c:251:7: branch_false: following 'false' branch (when 'filename' is NULL)...
ddcutil-2.2.1/src/base/dynamic_features.c:254:4: branch_false: ...to here
ddcutil-2.2.1/src/base/dynamic_features.c:254:4: danger: 'frec' leaks here; was allocated at [(6)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/5)
#  252|         frec->filename  = g_strdup(filename);
#  253|   
#  254|->    DBGTRC_DONE(debug, TRACE_GROUP, "Returning %p", frec);
#  255|      return frec;
#  256|   }

Error: CPPCHECK_WARNING (CWE-476): [#def152]
ddcutil-2.2.1/src/base/dynamic_features.c:507: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: s
#  505|                  model_name_seen = true;
#  506|                  char * s = strdup(t1.rest);
#  507|->                FIXUP_MODEL_NAME(s);
#  508|                  if ( !streq(s, model_name) ) {
#  509|                     ADD_ERROR(linectr, "Unexpected model name \"%s\", expected \"%s\"", t1.rest, model_name);

Error: CPPCHECK_WARNING (CWE-476): [#def153]
ddcutil-2.2.1/src/base/dynamic_features.c:556: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur_feature_metadata
#  554|   
#  555|                  cur_feature_metadata = calloc(1, sizeof(Dyn_Feature_Metadata));
#  556|->                memcpy(cur_feature_metadata->marker, DDCA_FEATURE_METADATA_MARKER, 4);
#  557|                  cur_feature_metadata->global_feature_flags = DDCA_USER_DEFINED | DDCA_PERSISTENT_METADATA;
#  558|   

Error: CPPCHECK_WARNING (CWE-476): [#def154]
ddcutil-2.2.1/src/base/dynamic_features.c:557: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur_feature_metadata
#  555|                  cur_feature_metadata = calloc(1, sizeof(Dyn_Feature_Metadata));
#  556|                  memcpy(cur_feature_metadata->marker, DDCA_FEATURE_METADATA_MARKER, 4);
#  557|->                cur_feature_metadata->global_feature_flags = DDCA_USER_DEFINED | DDCA_PERSISTENT_METADATA;
#  558|   
#  559|                  char * feature_code = t2.word;

Error: CPPCHECK_WARNING (CWE-476): [#def155]
ddcutil-2.2.1/src/base/execution_stats.c:273: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcounts
#  271|      g_mutex_lock(&status_code_counts_mutex);
#  272|      Status_Code_Counts * pcounts = calloc(1,sizeof(Status_Code_Counts));
#  273|->    memcpy(pcounts->marker, STATUS_CODE_COUNTS_MARKER, 4);
#  274|      pcounts->error_counts_hash =  g_hash_table_new(NULL,NULL);
#  275|      pcounts->total_status_counts = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def156]
ddcutil-2.2.1/src/base/execution_stats.c:274: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcounts
#  272|      Status_Code_Counts * pcounts = calloc(1,sizeof(Status_Code_Counts));
#  273|      memcpy(pcounts->marker, STATUS_CODE_COUNTS_MARKER, 4);
#  274|->    pcounts->error_counts_hash =  g_hash_table_new(NULL,NULL);
#  275|      pcounts->total_status_counts = 0;
#  276|      if (name)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def157]
ddcutil-2.2.1/src/base/execution_stats.c:274:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'pcounts'
ddcutil-2.2.1/src/base/execution_stats.c:272:35: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/execution_stats.c:274:4: danger: 'pcounts' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  272|      Status_Code_Counts * pcounts = calloc(1,sizeof(Status_Code_Counts));
#  273|      memcpy(pcounts->marker, STATUS_CODE_COUNTS_MARKER, 4);
#  274|->    pcounts->error_counts_hash =  g_hash_table_new(NULL,NULL);
#  275|      pcounts->total_status_counts = 0;
#  276|      if (name)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def158]
ddcutil-2.2.1/src/base/execution_stats.c:274:34: warning[-Wanalyzer-malloc-leak]: leak of 'pcounts'
ddcutil-2.2.1/src/base/execution_stats.c:272:35: acquire_memory: allocated here
ddcutil-2.2.1/src/base/execution_stats.c:274:34: danger: 'pcounts' leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  272|      Status_Code_Counts * pcounts = calloc(1,sizeof(Status_Code_Counts));
#  273|      memcpy(pcounts->marker, STATUS_CODE_COUNTS_MARKER, 4);
#  274|->    pcounts->error_counts_hash =  g_hash_table_new(NULL,NULL);
#  275|      pcounts->total_status_counts = 0;
#  276|      if (name)

Error: CPPCHECK_WARNING (CWE-476): [#def159]
ddcutil-2.2.1/src/base/execution_stats.c:275: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcounts
#  273|      memcpy(pcounts->marker, STATUS_CODE_COUNTS_MARKER, 4);
#  274|      pcounts->error_counts_hash =  g_hash_table_new(NULL,NULL);
#  275|->    pcounts->total_status_counts = 0;
#  276|      if (name)
#  277|         pcounts->name = g_strdup(name);

Error: CPPCHECK_WARNING (CWE-476): [#def160]
ddcutil-2.2.1/src/base/execution_stats.c:277: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcounts
#  275|      pcounts->total_status_counts = 0;
#  276|      if (name)
#  277|->       pcounts->name = g_strdup(name);
#  278|      g_mutex_unlock(&status_code_counts_mutex);
#  279|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def161]
ddcutil-2.2.1/src/base/execution_stats.c:278:4: warning[-Wanalyzer-malloc-leak]: leak of 'pcounts'
ddcutil-2.2.1/src/base/execution_stats.c:272:35: acquire_memory: allocated here
ddcutil-2.2.1/src/base/execution_stats.c:276:7: branch_false: following 'false' branch (when 'name' is NULL)...
ddcutil-2.2.1/src/base/execution_stats.c:278:4: branch_false: ...to here
ddcutil-2.2.1/src/base/execution_stats.c:278:4: danger: 'pcounts' leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  276|      if (name)
#  277|         pcounts->name = g_strdup(name);
#  278|->    g_mutex_unlock(&status_code_counts_mutex);
#  279|   
#  280|      DBGMSF(debug, "Done");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def162]
ddcutil-2.2.1/src/base/execution_stats.c:280:4: warning[-Wanalyzer-malloc-leak]: leak of 'pcounts'
ddcutil-2.2.1/src/base/execution_stats.c:272:35: acquire_memory: allocated here
ddcutil-2.2.1/src/base/execution_stats.c:276:7: branch_false: following 'false' branch (when 'name' is NULL)...
ddcutil-2.2.1/src/base/execution_stats.c:278:4: branch_false: ...to here
ddcutil-2.2.1/src/base/execution_stats.c:280:4: branch_true: following 'true' branch (when 'debug != 0')...
ddcutil-2.2.1/src/base/execution_stats.c:280:4: branch_true: ...to here
ddcutil-2.2.1/src/base/execution_stats.c:280:4: danger: 'pcounts' leaks here; was allocated at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#  278|      g_mutex_unlock(&status_code_counts_mutex);
#  279|   
#  280|->    DBGMSF(debug, "Done");
#  281|      return pcounts;
#  282|   }

Error: CPPCHECK_WARNING (CWE-476): [#def163]
ddcutil-2.2.1/src/base/feature_metadata.c:303: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: newentry
#  301|         while(true) {
#  302|            ct++;
#  303|->          newentry->value_code = oldentry->value_code;
#  304|            if (oldentry->value_name)
#  305|               newentry->value_name = g_strdup(oldentry->value_name);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def164]
ddcutil-2.2.1/src/base/feature_metadata.c:303:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'newentry'
ddcutil-2.2.1/src/base/feature_metadata.c:295:7: branch_true: following 'true' branch (when 'oldtable' is non-NULL)...
 branch_true: ...to here
ddcutil-2.2.1/src/base/feature_metadata.c:297:18: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/feature_metadata.c:303:10: danger: 'newentry' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  301|         while(true) {
#  302|            ct++;
#  303|->          newentry->value_code = oldentry->value_code;
#  304|            if (oldentry->value_name)
#  305|               newentry->value_name = g_strdup(oldentry->value_name);

Error: CPPCHECK_WARNING (CWE-682): [#def165]
ddcutil-2.2.1/src/base/feature_metadata.c:309: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  307|               break;
#  308|            oldentry++;
#  309|->          newentry++;
#  310|         };
#  311|         DBGMSF(debug, "Copied %d entries, including terminating entry", ct);

Error: CPPCHECK_WARNING (CWE-476): [#def166]
ddcutil-2.2.1/src/base/feature_metadata.c:488: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  486|   {
#  487|      Display_Feature_Metadata * result = calloc(1, sizeof(Display_Feature_Metadata));
#  488|->    memcpy(result->marker, DISPLAY_FEATURE_METADATA_MARKER, 4);
#  489|      result->feature_code = feature_code;
#  490|      return result;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def167]
ddcutil-2.2.1/src/base/feature_metadata.c:488:11: warning[-Wanalyzer-malloc-leak]: leak of 'dfm_new(*dyn_meta.feature_code)'
ddcutil-2.2.1/src/base/feature_metadata.c:522:1: enter_function: entry to 'dfm_from_dyn_feature_metadata'
ddcutil-2.2.1/src/base/feature_metadata.c:527:4: branch_false: following 'false' branch (when 'dyn_meta' is non-NULL)...
ddcutil-2.2.1/src/base/feature_metadata.c:528:4: branch_false: ...to here
ddcutil-2.2.1/src/base/feature_metadata.c:528:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/feature_metadata.c:532:37: branch_false: ...to here
ddcutil-2.2.1/src/base/feature_metadata.c:532:37: call_function: calling 'dfm_new' from 'dfm_from_dyn_feature_metadata'
ddcutil-2.2.1/src/base/feature_metadata.c:532:37: return_function: returning to 'dfm_from_dyn_feature_metadata' from 'dfm_new'
ddcutil-2.2.1/src/base/feature_metadata.c:534:24: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/feature_metadata.c:534:4: branch_false: ...to here
ddcutil-2.2.1/src/base/feature_metadata.c:535:24: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/feature_metadata.c:535:4: branch_false: ...to here
ddcutil-2.2.1/src/base/feature_metadata.c:488:11: danger: 'dfm_new(*dyn_meta.feature_code)' leaks here; was allocated at [(8)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/7)
#  486|   {
#  487|      Display_Feature_Metadata * result = calloc(1, sizeof(Display_Feature_Metadata));
#  488|->    memcpy(result->marker, DISPLAY_FEATURE_METADATA_MARKER, 4);
#  489|      result->feature_code = feature_code;
#  490|      return result;

Error: CPPCHECK_WARNING (CWE-476): [#def168]
ddcutil-2.2.1/src/base/feature_metadata.c:489: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  487|      Display_Feature_Metadata * result = calloc(1, sizeof(Display_Feature_Metadata));
#  488|      memcpy(result->marker, DISPLAY_FEATURE_METADATA_MARKER, 4);
#  489|->    result->feature_code = feature_code;
#  490|      return result;
#  491|   }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def169]
ddcutil-2.2.1/src/base/feature_metadata.c:489:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/base/feature_metadata.c:487:40: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/feature_metadata.c:489:4: danger: 'result' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0)
#  487|      Display_Feature_Metadata * result = calloc(1, sizeof(Display_Feature_Metadata));
#  488|      memcpy(result->marker, DISPLAY_FEATURE_METADATA_MARKER, 4);
#  489|->    result->feature_code = feature_code;
#  490|      return result;
#  491|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def170]
ddcutil-2.2.1/src/base/feature_metadata.c:556:4: warning[-Wanalyzer-malloc-leak]: leak of 'dfm_new(*dyn_meta.feature_code)'
ddcutil-2.2.1/src/base/feature_metadata.c:522:1: enter_function: entry to 'dfm_from_dyn_feature_metadata'
ddcutil-2.2.1/src/base/feature_metadata.c:527:4: branch_false: following 'false' branch (when 'dyn_meta' is non-NULL)...
ddcutil-2.2.1/src/base/feature_metadata.c:528:4: branch_false: ...to here
ddcutil-2.2.1/src/base/feature_metadata.c:528:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/feature_metadata.c:532:37: branch_false: ...to here
ddcutil-2.2.1/src/base/feature_metadata.c:532:37: call_function: calling 'dfm_new' from 'dfm_from_dyn_feature_metadata'
ddcutil-2.2.1/src/base/feature_metadata.c:532:37: return_function: returning to 'dfm_from_dyn_feature_metadata' from 'dfm_new'
ddcutil-2.2.1/src/base/feature_metadata.c:534:24: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/feature_metadata.c:534:51: call_function: inlined call to 'g_strdup_inline' from 'dfm_from_dyn_feature_metadata'
ddcutil-2.2.1/src/base/feature_metadata.c:535:24: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/feature_metadata.c:535:4: branch_false: ...to here
ddcutil-2.2.1/src/base/feature_metadata.c:538:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/feature_metadata.c:539:4: branch_false: ...to here
ddcutil-2.2.1/src/base/feature_metadata.c:539:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/feature_metadata.c:541:4: branch_false: ...to here
ddcutil-2.2.1/src/base/feature_metadata.c:541:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/feature_metadata.c:542:4: branch_false: ...to here
ddcutil-2.2.1/src/base/feature_metadata.c:542:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/feature_metadata.c:544:4: branch_false: ...to here
ddcutil-2.2.1/src/base/feature_metadata.c:551:21: call_function: calling 'copy_sl_value_table' from 'dfm_from_dyn_feature_metadata'
ddcutil-2.2.1/src/base/feature_metadata.c:551:21: return_function: returning to 'dfm_from_dyn_feature_metadata' from 'copy_sl_value_table'
ddcutil-2.2.1/src/base/feature_metadata.c:556:4: danger: 'dfm_new(*dyn_meta.feature_code)' leaks here; was allocated at [(8)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/7)
#  554|      if (debug)
#  555|         dbgrpt_display_feature_metadata(dfm, 2);
#  556|->    DBGTRC_DONE(debug, DDCA_TRC_NONE, "Returning dfm=%p", dfm);
#  557|      return dfm;
#  558|   }

Error: CPPCHECK_WARNING (CWE-476): [#def171]
ddcutil-2.2.1/src/base/feature_metadata.c:606: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ddca_meta
#  604|   
#  605|      DDCA_Feature_Metadata * ddca_meta = calloc(1, sizeof(DDCA_Feature_Metadata));
#  606|->    memcpy(ddca_meta->marker, DDCA_FEATURE_METADATA_MARKER, 4);
#  607|      ddca_meta->feature_code  = dfm->feature_code;
#  608|      ddca_meta->vcp_version   = dfm->vcp_version;

Error: CPPCHECK_WARNING (CWE-476): [#def172]
ddcutil-2.2.1/src/base/feature_metadata.c:607: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ddca_meta
#  605|      DDCA_Feature_Metadata * ddca_meta = calloc(1, sizeof(DDCA_Feature_Metadata));
#  606|      memcpy(ddca_meta->marker, DDCA_FEATURE_METADATA_MARKER, 4);
#  607|->    ddca_meta->feature_code  = dfm->feature_code;
#  608|      ddca_meta->vcp_version   = dfm->vcp_version;
#  609|      ddca_meta->feature_flags = dfm->version_feature_flags;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def173]
ddcutil-2.2.1/src/base/feature_metadata.c:607:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'ddca_meta'
ddcutil-2.2.1/src/base/feature_metadata.c:605:40: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/feature_metadata.c:607:4: danger: 'ddca_meta' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/0)
#  605|      DDCA_Feature_Metadata * ddca_meta = calloc(1, sizeof(DDCA_Feature_Metadata));
#  606|      memcpy(ddca_meta->marker, DDCA_FEATURE_METADATA_MARKER, 4);
#  607|->    ddca_meta->feature_code  = dfm->feature_code;
#  608|      ddca_meta->vcp_version   = dfm->vcp_version;
#  609|      ddca_meta->feature_flags = dfm->version_feature_flags;

Error: CPPCHECK_WARNING (CWE-476): [#def174]
ddcutil-2.2.1/src/base/feature_metadata.c:608: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ddca_meta
#  606|      memcpy(ddca_meta->marker, DDCA_FEATURE_METADATA_MARKER, 4);
#  607|      ddca_meta->feature_code  = dfm->feature_code;
#  608|->    ddca_meta->vcp_version   = dfm->vcp_version;
#  609|      ddca_meta->feature_flags = dfm->version_feature_flags;
#  610|      if (dfm->global_feature_flags & DDCA_PERSISTENT_METADATA)

Error: CPPCHECK_WARNING (CWE-476): [#def175]
ddcutil-2.2.1/src/base/feature_metadata.c:609: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ddca_meta
#  607|      ddca_meta->feature_code  = dfm->feature_code;
#  608|      ddca_meta->vcp_version   = dfm->vcp_version;
#  609|->    ddca_meta->feature_flags = dfm->version_feature_flags;
#  610|      if (dfm->global_feature_flags & DDCA_PERSISTENT_METADATA)
#  611|         ddca_meta->feature_flags |= DDCA_PERSISTENT_METADATA;

Error: CPPCHECK_WARNING (CWE-476): [#def176]
ddcutil-2.2.1/src/base/feature_metadata.c:614: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ddca_meta
#  612|      // ddca_meta->feature_flags &= ~DDCA_PERSISTENT_METADATA;
#  613|      // ddca_meta->feature_flags &= ~DDCA_SYNTHETIC_VCP_FEATURE_TABLE_ENTRY;
#  614|->    ddca_meta->feature_name = (dfm->feature_name) ? g_strdup(dfm->feature_name) : NULL;
#  615|      ddca_meta->feature_desc = (dfm->feature_desc) ? g_strdup(dfm->feature_desc) : NULL;
#  616|      DBGMSF(debug, "** dfm->sl_values = %p", dfm->sl_values);

Error: CPPCHECK_WARNING (CWE-476): [#def177]
ddcutil-2.2.1/src/base/feature_metadata.c:615: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ddca_meta
#  613|      // ddca_meta->feature_flags &= ~DDCA_SYNTHETIC_VCP_FEATURE_TABLE_ENTRY;
#  614|      ddca_meta->feature_name = (dfm->feature_name) ? g_strdup(dfm->feature_name) : NULL;
#  615|->    ddca_meta->feature_desc = (dfm->feature_desc) ? g_strdup(dfm->feature_desc) : NULL;
#  616|      DBGMSF(debug, "** dfm->sl_values = %p", dfm->sl_values);
#  617|      ddca_meta->sl_values = copy_sl_value_table(dfm->sl_values);

Error: CPPCHECK_WARNING (CWE-476): [#def178]
ddcutil-2.2.1/src/base/feature_metadata.c:617: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ddca_meta
#  615|      ddca_meta->feature_desc = (dfm->feature_desc) ? g_strdup(dfm->feature_desc) : NULL;
#  616|      DBGMSF(debug, "** dfm->sl_values = %p", dfm->sl_values);
#  617|->    ddca_meta->sl_values = copy_sl_value_table(dfm->sl_values);
#  618|   
#  619|      DBGTRC_RET_STRUCT(debug, DDCA_TRC_NONE, DDCA_Feature_Metadata,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def179]
ddcutil-2.2.1/src/base/feature_metadata.c:619:4: warning[-Wanalyzer-malloc-leak]: leak of 'ddca_meta'
ddcutil-2.2.1/src/base/feature_metadata.c:597:1: enter_function: entry to 'dfm_to_ddca_feature_metadata'
ddcutil-2.2.1/src/base/feature_metadata.c:605:40: acquire_memory: allocated here
ddcutil-2.2.1/src/base/feature_metadata.c:614:30: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/feature_metadata.c:614:52: call_function: inlined call to 'g_strdup_inline' from 'dfm_to_ddca_feature_metadata'
ddcutil-2.2.1/src/base/feature_metadata.c:615:30: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/feature_metadata.c:615:4: branch_false: ...to here
ddcutil-2.2.1/src/base/feature_metadata.c:617:27: call_function: calling 'copy_sl_value_table' from 'dfm_to_ddca_feature_metadata'
ddcutil-2.2.1/src/base/feature_metadata.c:617:27: return_function: returning to 'dfm_to_ddca_feature_metadata' from 'copy_sl_value_table'
ddcutil-2.2.1/src/base/feature_metadata.c:619:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/feature_metadata.c:619:4: branch_false: ...to here
ddcutil-2.2.1/src/base/feature_metadata.c:619:4: danger: 'ddca_meta' leaks here; was allocated at [(2)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/1)
#  617|      ddca_meta->sl_values = copy_sl_value_table(dfm->sl_values);
#  618|   
#  619|->    DBGTRC_RET_STRUCT(debug, DDCA_TRC_NONE, DDCA_Feature_Metadata,
#  620|                        dbgrpt_ddca_feature_metadata, ddca_meta);
#  621|      return ddca_meta;

Error: CPPCHECK_WARNING (CWE-476): [#def180]
ddcutil-2.2.1/src/base/i2c_bus_base.c:304: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: businfo
#  302|      assert(busno != 255 && busno != -1);
#  303|      I2C_Bus_Info * businfo = calloc(1, sizeof(I2C_Bus_Info));
#  304|->    memcpy(businfo->marker, I2C_BUS_INFO_MARKER, 4);
#  305|      businfo->busno = busno;
#  306|      businfo->drm_connector_found_by = DRM_CONNECTOR_NOT_CHECKED;

Error: CPPCHECK_WARNING (CWE-476): [#def181]
ddcutil-2.2.1/src/base/i2c_bus_base.c:305: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: businfo
#  303|      I2C_Bus_Info * businfo = calloc(1, sizeof(I2C_Bus_Info));
#  304|      memcpy(businfo->marker, I2C_BUS_INFO_MARKER, 4);
#  305|->    businfo->busno = busno;
#  306|      businfo->drm_connector_found_by = DRM_CONNECTOR_NOT_CHECKED;
#  307|   #ifdef ALT_LOCK_REC

Error: GCC_ANALYZER_WARNING (CWE-476): [#def182]
ddcutil-2.2.1/src/base/i2c_bus_base.c:305:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'businfo'
ddcutil-2.2.1/src/base/i2c_bus_base.c:302:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/i2c_bus_base.c:303:29: branch_false: ...to here
ddcutil-2.2.1/src/base/i2c_bus_base.c:303:29: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/i2c_bus_base.c:305:4: danger: 'businfo' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  303|      I2C_Bus_Info * businfo = calloc(1, sizeof(I2C_Bus_Info));
#  304|      memcpy(businfo->marker, I2C_BUS_INFO_MARKER, 4);
#  305|->    businfo->busno = busno;
#  306|      businfo->drm_connector_found_by = DRM_CONNECTOR_NOT_CHECKED;
#  307|   #ifdef ALT_LOCK_REC

Error: CPPCHECK_WARNING (CWE-476): [#def183]
ddcutil-2.2.1/src/base/i2c_bus_base.c:306: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: businfo
#  304|      memcpy(businfo->marker, I2C_BUS_INFO_MARKER, 4);
#  305|      businfo->busno = busno;
#  306|->    businfo->drm_connector_found_by = DRM_CONNECTOR_NOT_CHECKED;
#  307|   #ifdef ALT_LOCK_REC
#  308|      businfo->lock_record = create_display_lock_record(i2c_io_path(busno));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def184]
ddcutil-2.2.1/src/base/i2c_bus_base.c:310:4: warning[-Wanalyzer-malloc-leak]: leak of 'businfo'
ddcutil-2.2.1/src/base/i2c_bus_base.c:302:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/i2c_bus_base.c:303:29: branch_false: ...to here
ddcutil-2.2.1/src/base/i2c_bus_base.c:303:29: acquire_memory: allocated here
ddcutil-2.2.1/src/base/i2c_bus_base.c:310:4: danger: 'businfo' leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#  308|      businfo->lock_record = create_display_lock_record(i2c_io_path(busno));
#  309|   #endif
#  310|->    DBGTRC_DONE(debug, TRACE_GROUP, "Returning: %p", businfo);
#  311|      return businfo;
#  312|   }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def185]
ddcutil-2.2.1/src/base/linux_errno.c:363:11: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
ddcutil-2.2.1/src/base/linux_errno.c:361:8: enter_function: entry to 'linux_errno_name'
ddcutil-2.2.1/src/base/linux_errno.c:362:31: call_function: calling 'find_errno_description' from 'linux_errno_name'
ddcutil-2.2.1/src/base/linux_errno.c:362:31: return_function: returning to 'linux_errno_name' from 'find_errno_description'
ddcutil-2.2.1/src/base/linux_errno.c:363:11: danger: dereference of NULL 'find_errno_description(error_number)'
#  361|   char * linux_errno_name(int error_number) {
#  362|      Status_Code_Info * pdesc = find_errno_description(error_number);
#  363|->    return pdesc->name;
#  364|   }
#  365|   

Error: CPPCHECK_WARNING (CWE-476): [#def186]
ddcutil-2.2.1/src/base/monitor_model_key.c:94: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#   92|      Monitor_Model_Key * result = calloc(1, sizeof(Monitor_Model_Key));
#   93|      // memcpy(result->marker, MONITOR_MODEL_KEY_MARKER, 4);
#   94|->    STRLCPY(result->mfg_id,     mfg_id,     EDID_MFG_ID_FIELD_SIZE);
#   95|      STRLCPY(result->model_name, model_name, EDID_MODEL_NAME_FIELD_SIZE);
#   96|      FIXUP_MODEL_NAME(result->model_name);

Error: CPPCHECK_WARNING (CWE-476): [#def187]
ddcutil-2.2.1/src/base/monitor_model_key.c:95: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#   93|      // memcpy(result->marker, MONITOR_MODEL_KEY_MARKER, 4);
#   94|      STRLCPY(result->mfg_id,     mfg_id,     EDID_MFG_ID_FIELD_SIZE);
#   95|->    STRLCPY(result->model_name, model_name, EDID_MODEL_NAME_FIELD_SIZE);
#   96|      FIXUP_MODEL_NAME(result->model_name);
#   97|      result->product_code = product_code;

Error: CPPCHECK_WARNING (CWE-476): [#def188]
ddcutil-2.2.1/src/base/monitor_model_key.c:96: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#   94|      STRLCPY(result->mfg_id,     mfg_id,     EDID_MFG_ID_FIELD_SIZE);
#   95|      STRLCPY(result->model_name, model_name, EDID_MODEL_NAME_FIELD_SIZE);
#   96|->    FIXUP_MODEL_NAME(result->model_name);
#   97|      result->product_code = product_code;
#   98|      result->defined = true;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def189]
ddcutil-2.2.1/src/base/monitor_model_key.c:97:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/base/monitor_model_key.c:89:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/monitor_model_key.c:90:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/monitor_model_key.c:92:33: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/monitor_model_key.c:97:4: danger: 'result' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
#   95|      STRLCPY(result->model_name, model_name, EDID_MODEL_NAME_FIELD_SIZE);
#   96|      FIXUP_MODEL_NAME(result->model_name);
#   97|->    result->product_code = product_code;
#   98|      result->defined = true;
#   99|      return result;

Error: CPPCHECK_WARNING (CWE-476): [#def190]
ddcutil-2.2.1/src/base/monitor_model_key.c:159: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  157|      if (mmk.defined) {
#  158|         result = calloc(1, sizeof(Monitor_Model_Key));
#  159|->       memcpy(result, &mmk, sizeof(Monitor_Model_Key));
#  160|   #ifdef ALTERNATIVE
#  161|         Monitor_Model_Key * result2 = mmk_new(

Error: GCC_ANALYZER_WARNING (CWE-476): [#def191]
ddcutil-2.2.1/src/base/monitor_model_key.c:159:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/base/monitor_model_key.c:157:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/monitor_model_key.c:158:16: branch_true: ...to here
ddcutil-2.2.1/src/base/monitor_model_key.c:158:16: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/monitor_model_key.c:159:7: danger: 'result' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#  157|      if (mmk.defined) {
#  158|         result = calloc(1, sizeof(Monitor_Model_Key));
#  159|->       memcpy(result, &mmk, sizeof(Monitor_Model_Key));
#  160|   #ifdef ALTERNATIVE
#  161|         Monitor_Model_Key * result2 = mmk_new(

Error: CPPCHECK_WARNING (CWE-476): [#def192]
ddcutil-2.2.1/src/base/monitor_model_key.c:169: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  167|   #endif
#  168|   
#  169|->       assert(monitor_model_key_eq(mmk, *result));
#  170|      }
#  171|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def193]
ddcutil-2.2.1/src/base/monitor_model_key.c:173:7: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/base/monitor_model_key.c:152:1: enter_function: entry to 'mmk_new_from_value'
ddcutil-2.2.1/src/base/monitor_model_key.c:157:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/monitor_model_key.c:158:16: branch_true: ...to here
ddcutil-2.2.1/src/base/monitor_model_key.c:158:16: acquire_memory: allocated here
ddcutil-2.2.1/src/base/monitor_model_key.c:169:7: call_function: calling 'monitor_model_key_eq' from 'mmk_new_from_value'
ddcutil-2.2.1/src/base/monitor_model_key.c:169:7: return_function: returning to 'mmk_new_from_value' from 'monitor_model_key_eq'
ddcutil-2.2.1/src/base/monitor_model_key.c:169:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/monitor_model_key.c:173:7: branch_true: ...to here
ddcutil-2.2.1/src/base/monitor_model_key.c:173:7: call_function: calling 'mmk_repr' from 'mmk_new_from_value'
ddcutil-2.2.1/src/base/monitor_model_key.c:173:7: return_function: returning to 'mmk_new_from_value' from 'mmk_repr'
ddcutil-2.2.1/src/base/monitor_model_key.c:173:7: danger: 'result' leaks here; was allocated at [(4)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/3)
#  171|   
#  172|      if (result)
#  173|->       DBGTRC_DONE(debug, DDCA_TRC_NONE, "Returning: %p -> %s", result, mmk_repr(*result));
#  174|      else
#  175|         DBGTRC_DONE(debug, DDCA_TRC_NONE, "Returning: NULL");

Error: CPPCHECK_WARNING (CWE-476): [#def194]
ddcutil-2.2.1/src/base/monitor_model_key.c:210: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  208|      if (edid) {
#  209|         result = calloc(1, sizeof(Monitor_Model_Key));
#  210|->       memcpy(result->mfg_id, edid->mfg_id, EDID_MFG_ID_FIELD_SIZE);
#  211|         memcpy(result->model_name, edid->model_name, EDID_MODEL_NAME_FIELD_SIZE);
#  212|         FIXUP_MODEL_NAME(result->model_name);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def195]
ddcutil-2.2.1/src/base/monitor_model_key.c:210:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/base/monitor_model_key.c:208:7: branch_true: following 'true' branch (when 'edid' is non-NULL)...
ddcutil-2.2.1/src/base/monitor_model_key.c:209:16: branch_true: ...to here
ddcutil-2.2.1/src/base/monitor_model_key.c:209:16: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/monitor_model_key.c:210:7: danger: 'result' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/2)
#  208|      if (edid) {
#  209|         result = calloc(1, sizeof(Monitor_Model_Key));
#  210|->       memcpy(result->mfg_id, edid->mfg_id, EDID_MFG_ID_FIELD_SIZE);
#  211|         memcpy(result->model_name, edid->model_name, EDID_MODEL_NAME_FIELD_SIZE);
#  212|         FIXUP_MODEL_NAME(result->model_name);

Error: CPPCHECK_WARNING (CWE-476): [#def196]
ddcutil-2.2.1/src/base/monitor_model_key.c:211: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  209|         result = calloc(1, sizeof(Monitor_Model_Key));
#  210|         memcpy(result->mfg_id, edid->mfg_id, EDID_MFG_ID_FIELD_SIZE);
#  211|->       memcpy(result->model_name, edid->model_name, EDID_MODEL_NAME_FIELD_SIZE);
#  212|         FIXUP_MODEL_NAME(result->model_name);
#  213|         result->product_code = edid->product_code;

Error: CPPCHECK_WARNING (CWE-476): [#def197]
ddcutil-2.2.1/src/base/monitor_model_key.c:212: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  210|         memcpy(result->mfg_id, edid->mfg_id, EDID_MFG_ID_FIELD_SIZE);
#  211|         memcpy(result->model_name, edid->model_name, EDID_MODEL_NAME_FIELD_SIZE);
#  212|->       FIXUP_MODEL_NAME(result->model_name);
#  213|         result->product_code = edid->product_code;
#  214|         result->defined = true;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def198]
ddcutil-2.2.1/src/base/monitor_model_key.c:355:17: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/base/monitor_model_key.c:152:1: enter_function: entry to 'mmk_new_from_value'
ddcutil-2.2.1/src/base/monitor_model_key.c:157:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/monitor_model_key.c:158:16: branch_true: ...to here
ddcutil-2.2.1/src/base/monitor_model_key.c:158:16: acquire_memory: allocated here
ddcutil-2.2.1/src/base/monitor_model_key.c:169:7: call_function: calling 'monitor_model_key_eq' from 'mmk_new_from_value'
ddcutil-2.2.1/src/base/monitor_model_key.c:169:7: return_function: returning to 'mmk_new_from_value' from 'monitor_model_key_eq'
ddcutil-2.2.1/src/base/monitor_model_key.c:169:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/monitor_model_key.c:173:7: branch_true: ...to here
ddcutil-2.2.1/src/base/monitor_model_key.c:173:7: call_function: calling 'mmk_repr' from 'mmk_new_from_value'
#  353|      static GPrivate  dh_buf_key = G_PRIVATE_INIT(g_free);
#  354|      const int bufsz = 100;
#  355|->    char * buf = get_thread_fixed_buffer(&dh_buf_key, bufsz);
#  356|   
#  357|      if (!mmk.defined)

Error: CPPCHECK_WARNING (CWE-476): [#def199]
ddcutil-2.2.1/src/base/per_thread_data.c:547: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: function_stats
#  545|         if (!function_stats) {
#  546|            function_stats = calloc(1, sizeof(Per_Thread_Function_Stats));
#  547|->          function_stats->function = strdup(func);
#  548|            g_hash_table_insert(stats_table, strdup(func), function_stats);
#  549|         }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def200]
ddcutil-2.2.1/src/base/per_thread_data.c:547:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'function_stats'
ddcutil-2.2.1/src/base/per_thread_data.c:536:6: enter_function: entry to 'ptd_profile_function_end'
ddcutil-2.2.1/src/base/per_thread_data.c:538:29: call_function: calling 'ptd_get_per_thread_data' from 'ptd_profile_function_end'
ddcutil-2.2.1/src/base/per_thread_data.c:538:29: return_function: returning to 'ptd_profile_function_end' from 'ptd_get_per_thread_data'
ddcutil-2.2.1/src/base/per_thread_data.c:541:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:542:43: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:542:43: call_function: calling 'ptd_profile_get_stats' from 'ptd_profile_function_end'
ddcutil-2.2.1/src/base/per_thread_data.c:542:43: return_function: returning to 'ptd_profile_function_end' from 'ptd_profile_get_stats'
ddcutil-2.2.1/src/base/per_thread_data.c:545:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:546:27: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:546:27: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/per_thread_data.c:547:10: danger: 'function_stats' could be NULL: unchecked value from [(19)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/18)
#  545|         if (!function_stats) {
#  546|            function_stats = calloc(1, sizeof(Per_Thread_Function_Stats));
#  547|->          function_stats->function = strdup(func);
#  548|            g_hash_table_insert(stats_table, strdup(func), function_stats);
#  549|         }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def201]
ddcutil-2.2.1/src/base/per_thread_data.c:548:10: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/base/per_thread_data.c:536:6: enter_function: entry to 'ptd_profile_function_end'
ddcutil-2.2.1/src/base/per_thread_data.c:538:29: call_function: calling 'ptd_get_per_thread_data' from 'ptd_profile_function_end'
ddcutil-2.2.1/src/base/per_thread_data.c:538:29: return_function: returning to 'ptd_profile_function_end' from 'ptd_get_per_thread_data'
ddcutil-2.2.1/src/base/per_thread_data.c:541:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:542:43: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:542:43: call_function: calling 'ptd_profile_get_stats' from 'ptd_profile_function_end'
ddcutil-2.2.1/src/base/per_thread_data.c:542:43: return_function: returning to 'ptd_profile_function_end' from 'ptd_profile_get_stats'
ddcutil-2.2.1/src/base/per_thread_data.c:545:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:546:27: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:547:37: acquire_memory: allocated here
ddcutil-2.2.1/src/base/per_thread_data.c:548:10: danger: '<unknown>' leaks here; was allocated at [(19)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/18)
#  546|            function_stats = calloc(1, sizeof(Per_Thread_Function_Stats));
#  547|            function_stats->function = strdup(func);
#  548|->          g_hash_table_insert(stats_table, strdup(func), function_stats);
#  549|         }
#  550|         uint64_t elapsed_nanosec = cur_realtime_nanosec() - ptd->cur_start;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def202]
ddcutil-2.2.1/src/base/per_thread_data.c:548:10: warning[-Wanalyzer-malloc-leak]: leak of 'function_stats'
ddcutil-2.2.1/src/base/per_thread_data.c:536:6: enter_function: entry to 'ptd_profile_function_end'
ddcutil-2.2.1/src/base/per_thread_data.c:538:29: call_function: calling 'ptd_get_per_thread_data' from 'ptd_profile_function_end'
ddcutil-2.2.1/src/base/per_thread_data.c:538:29: return_function: returning to 'ptd_profile_function_end' from 'ptd_get_per_thread_data'
ddcutil-2.2.1/src/base/per_thread_data.c:541:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:542:43: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:542:43: call_function: calling 'ptd_profile_get_stats' from 'ptd_profile_function_end'
ddcutil-2.2.1/src/base/per_thread_data.c:542:43: return_function: returning to 'ptd_profile_function_end' from 'ptd_profile_get_stats'
ddcutil-2.2.1/src/base/per_thread_data.c:545:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:546:27: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:546:27: acquire_memory: allocated here
ddcutil-2.2.1/src/base/per_thread_data.c:548:10: danger: 'function_stats' leaks here; was allocated at [(19)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/18)
#  546|            function_stats = calloc(1, sizeof(Per_Thread_Function_Stats));
#  547|            function_stats->function = strdup(func);
#  548|->          g_hash_table_insert(stats_table, strdup(func), function_stats);
#  549|         }
#  550|         uint64_t elapsed_nanosec = cur_realtime_nanosec() - ptd->cur_start;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def203]
ddcutil-2.2.1/src/base/per_thread_data.c:548:10: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(func)'
ddcutil-2.2.1/src/base/per_thread_data.c:536:6: enter_function: entry to 'ptd_profile_function_end'
ddcutil-2.2.1/src/base/per_thread_data.c:538:29: call_function: calling 'ptd_get_per_thread_data' from 'ptd_profile_function_end'
ddcutil-2.2.1/src/base/per_thread_data.c:538:29: return_function: returning to 'ptd_profile_function_end' from 'ptd_get_per_thread_data'
ddcutil-2.2.1/src/base/per_thread_data.c:541:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:542:43: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:542:43: call_function: calling 'ptd_profile_get_stats' from 'ptd_profile_function_end'
ddcutil-2.2.1/src/base/per_thread_data.c:542:43: return_function: returning to 'ptd_profile_function_end' from 'ptd_profile_get_stats'
ddcutil-2.2.1/src/base/per_thread_data.c:545:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:546:27: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:548:43: acquire_memory: allocated here
ddcutil-2.2.1/src/base/per_thread_data.c:548:10: danger: 'strdup(func)' leaks here; was allocated at [(19)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/18)
#  546|            function_stats = calloc(1, sizeof(Per_Thread_Function_Stats));
#  547|            function_stats->function = strdup(func);
#  548|->          g_hash_table_insert(stats_table, strdup(func), function_stats);
#  549|         }
#  550|         uint64_t elapsed_nanosec = cur_realtime_nanosec() - ptd->cur_start;

Error: CPPCHECK_WARNING (CWE-476): [#def204]
ddcutil-2.2.1/src/base/per_thread_data.c:611: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur_summary_entry
#  609|         DBGMSF(debug, "      Per_Thread_Function_Stats not found for %s", cfs->function);
#  610|         cur_summary_entry = calloc(1, sizeof(Per_Thread_Function_Stats));
#  611|->       cur_summary_entry->function = strdup(cfs->function);
#  612|         g_hash_table_insert(summary_table, strdup(cfs->function), cur_summary_entry);
#  613|      }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def205]
ddcutil-2.2.1/src/base/per_thread_data.c:611:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_summary_entry'
ddcutil-2.2.1/src/base/per_thread_data.c:604:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:607:45: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:608:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:610:27: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:610:27: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/per_thread_data.c:611:7: danger: 'cur_summary_entry' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/4)
#  609|         DBGMSF(debug, "      Per_Thread_Function_Stats not found for %s", cfs->function);
#  610|         cur_summary_entry = calloc(1, sizeof(Per_Thread_Function_Stats));
#  611|->       cur_summary_entry->function = strdup(cfs->function);
#  612|         g_hash_table_insert(summary_table, strdup(cfs->function), cur_summary_entry);
#  613|      }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def206]
ddcutil-2.2.1/src/base/per_thread_data.c:612:7: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/base/per_thread_data.c:604:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:607:45: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:608:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:610:27: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:611:37: acquire_memory: allocated here
ddcutil-2.2.1/src/base/per_thread_data.c:612:7: danger: '<unknown>' leaks here; was allocated at [(5)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/4)
#  610|         cur_summary_entry = calloc(1, sizeof(Per_Thread_Function_Stats));
#  611|         cur_summary_entry->function = strdup(cfs->function);
#  612|->       g_hash_table_insert(summary_table, strdup(cfs->function), cur_summary_entry);
#  613|      }
#  614|      cur_summary_entry->total_calls += cfs->total_calls;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def207]
ddcutil-2.2.1/src/base/per_thread_data.c:612:7: warning[-Wanalyzer-malloc-leak]: leak of 'cur_summary_entry'
ddcutil-2.2.1/src/base/per_thread_data.c:604:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:607:45: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:608:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:610:27: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:610:27: acquire_memory: allocated here
ddcutil-2.2.1/src/base/per_thread_data.c:612:7: danger: 'cur_summary_entry' leaks here; was allocated at [(5)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/4)
#  610|         cur_summary_entry = calloc(1, sizeof(Per_Thread_Function_Stats));
#  611|         cur_summary_entry->function = strdup(cfs->function);
#  612|->       g_hash_table_insert(summary_table, strdup(cfs->function), cur_summary_entry);
#  613|      }
#  614|      cur_summary_entry->total_calls += cfs->total_calls;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def208]
ddcutil-2.2.1/src/base/per_thread_data.c:612:7: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(*(Per_Thread_Function_Stats *)cur_func_stats.function)'
ddcutil-2.2.1/src/base/per_thread_data.c:604:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:607:45: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:608:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/per_thread_data.c:610:27: branch_true: ...to here
ddcutil-2.2.1/src/base/per_thread_data.c:612:42: acquire_memory: allocated here
ddcutil-2.2.1/src/base/per_thread_data.c:612:7: danger: 'strdup(*(Per_Thread_Function_Stats *)cur_func_stats.function)' leaks here; was allocated at [(5)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/4)
#  610|         cur_summary_entry = calloc(1, sizeof(Per_Thread_Function_Stats));
#  611|         cur_summary_entry->function = strdup(cfs->function);
#  612|->       g_hash_table_insert(summary_table, strdup(cfs->function), cur_summary_entry);
#  613|      }
#  614|      cur_summary_entry->total_calls += cfs->total_calls;

Error: GCC_ANALYZER_WARNING (CWE-404): [#def209]
ddcutil-2.2.1/src/base/sleep.c:109:17: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
ddcutil-2.2.1/src/base/sleep.c:108:7: acquire_resource: 'va_start' called here
ddcutil-2.2.1/src/base/sleep.c:109:17: danger: missing call to 'va_end' to match 'va_start' at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  107|         va_list(args);
#  108|         va_start(args, format);
#  109|->       message = g_strdup_vprintf(format, args);
#  110|         va_end(args);
#  111|      }

Error: CPPCHECK_WARNING (CWE-476): [#def210]
ddcutil-2.2.1/src/base/trace_control.c:261: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: temp
#  259|            int newsz = strlen(bname) + 2 + 1;
#  260|            gchar * temp = calloc(1, newsz);
#  261|->          strcpy(temp, bname);
#  262|            strcat(temp, ".c");
#  263|            free(bname);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def211]
ddcutil-2.2.1/src/base/trace_control.c:261:10: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'temp' where non-null expected
ddcutil-2.2.1/src/base/trace_control.c:256:7: branch_true: following 'true' branch (when 'filename' is non-NULL)...
ddcutil-2.2.1/src/base/trace_control.c:257:15: branch_true: ...to here
ddcutil-2.2.1/src/base/trace_control.c:258:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/trace_control.c:259:22: branch_false: ...to here
ddcutil-2.2.1/src/base/trace_control.c:260:25: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/base/trace_control.c:261:10: danger: argument 1 ('temp') from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
#argument 1 of '__builtin_strcpy' must be non-null
#  259|            int newsz = strlen(bname) + 2 + 1;
#  260|            gchar * temp = calloc(1, newsz);
#  261|->          strcpy(temp, bname);
#  262|            strcat(temp, ".c");
#  263|            free(bname);

Error: CPPCHECK_WARNING (CWE-476): [#def212]
ddcutil-2.2.1/src/base/trace_control.c:262: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: temp
#  260|            gchar * temp = calloc(1, newsz);
#  261|            strcpy(temp, bname);
#  262|->          strcat(temp, ".c");
#  263|            free(bname);
#  264|            bname = temp;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def213]
ddcutil-2.2.1/src/base/trace_control.c:267:23: warning[-Wanalyzer-malloc-leak]: leak of 'bname'
ddcutil-2.2.1/src/base/trace_control.c:256:7: branch_true: following 'true' branch (when 'filename' is non-NULL)...
ddcutil-2.2.1/src/base/trace_control.c:257:15: branch_true: ...to here
ddcutil-2.2.1/src/base/trace_control.c:258:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/trace_control.c:259:22: branch_false: ...to here
ddcutil-2.2.1/src/base/trace_control.c:260:25: acquire_memory: allocated here
ddcutil-2.2.1/src/base/trace_control.c:267:23: danger: 'bname' leaks here; was allocated at [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
#  265|         }
#  266|   
#  267|->       bool missing = (gaux_string_ptr_array_find(traced_file_table, bname) < 0);
#  268|         if (missing)
#  269|            g_ptr_array_add(traced_file_table, bname);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def214]
ddcutil-2.2.1/src/base/trace_control.c:269:10: warning[-Wanalyzer-malloc-leak]: leak of 'bname'
ddcutil-2.2.1/src/base/trace_control.c:256:7: branch_true: following 'true' branch (when 'filename' is non-NULL)...
ddcutil-2.2.1/src/base/trace_control.c:257:15: branch_true: ...to here
ddcutil-2.2.1/src/base/trace_control.c:258:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/base/trace_control.c:259:22: branch_false: ...to here
ddcutil-2.2.1/src/base/trace_control.c:260:25: acquire_memory: allocated here
ddcutil-2.2.1/src/base/trace_control.c:268:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/base/trace_control.c:269:10: branch_true: ...to here
ddcutil-2.2.1/src/base/trace_control.c:269:10: danger: 'bname' leaks here; was allocated at [(5)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/4)
#  267|         bool missing = (gaux_string_ptr_array_find(traced_file_table, bname) < 0);
#  268|         if (missing)
#  269|->          g_ptr_array_add(traced_file_table, bname);
#  270|         else
#  271|            free(bname);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def215]
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:298:16: warning[-Wanalyzer-malloc-leak]: leak of 'fsref'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:360:19: enter_function: entry to 'parse_feature_ids_or_subset'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:364:30: acquire_memory: allocated here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:366:7: branch_true: following 'true' branch (when 'vals_ct <= 1')...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:367:20: branch_true: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:368:38: call_function: calling 'find_subset' from 'parse_feature_ids_or_subset'
#  296|      assert(name && (cmd_id == CMDID_GETVCP || cmd_id == CMDID_VCPINFO));
#  297|      VCP_Feature_Subset result = VCP_SUBSET_NONE;
#  298|->    char * us = strdup_uc(name);
#  299|      int ndx = 0;
#  300|      for (;ndx < subset_table_ct; ndx++) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def216]
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:301:12: warning[-Wanalyzer-malloc-leak]: leak of 'fsref'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:360:19: enter_function: entry to 'parse_feature_ids_or_subset'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:364:30: acquire_memory: allocated here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:366:7: branch_true: following 'true' branch (when 'vals_ct <= 1')...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:367:20: branch_true: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:368:38: call_function: calling 'find_subset' from 'parse_feature_ids_or_subset'
#  299|      int ndx = 0;
#  300|      for (;ndx < subset_table_ct; ndx++) {
#  301|->       if ( is_abbrev(us, subset_table[ndx].subset_name, subset_table[ndx].min_chars) ) {
#  302|            if (cmd_id & subset_table[ndx].valid_commands)
#  303|               result = subset_table[ndx].subset_id;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def217]
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:370:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'fsref'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:360:19: enter_function: entry to 'parse_feature_ids_or_subset'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:364:30: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:366:7: branch_true: following 'true' branch (when 'vals_ct <= 1')...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:367:20: branch_true: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:368:38: call_function: calling 'find_subset' from 'parse_feature_ids_or_subset'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:368:38: return_function: returning to 'parse_feature_ids_or_subset' from 'find_subset'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:369:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:370:10: branch_true: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:370:10: danger: 'fsref' could be NULL: unchecked value from [(2)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/1)
#  368|         VCP_Feature_Subset subset_id = find_subset(val, cmd_id);
#  369|         if (subset_id != VCP_SUBSET_NONE) {
#  370|->          fsref->subset = subset_id;
#  371|            ok = true;
#  372|         }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def218]
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:375:15: warning[-Wanalyzer-malloc-leak]: leak of 'fsref'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:360:19: enter_function: entry to 'parse_feature_ids_or_subset'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:364:30: acquire_memory: allocated here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:366:7: branch_true: following 'true' branch (when 'vals_ct <= 1')...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:367:20: branch_true: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:368:38: call_function: calling 'find_subset' from 'parse_feature_ids_or_subset'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:368:38: return_function: returning to 'parse_feature_ids_or_subset' from 'find_subset'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:369:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:374:15: branch_false: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:375:15: danger: 'fsref' leaks here; was allocated at [(2)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/1)
#  373|         else {
#  374|            Byte feature_hexid = 0;   // temp
#  375|->          ok = any_one_byte_hex_string_to_byte_in_buf(val, &feature_hexid);
#  376|            if (ok) {
#  377|               fsref->subset = VCP_SUBSET_SINGLE_FEATURE;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def219]
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:377:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'fsref'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:360:19: enter_function: entry to 'parse_feature_ids_or_subset'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:364:30: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:366:7: branch_true: following 'true' branch (when 'vals_ct <= 1')...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:367:20: branch_true: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:368:38: call_function: calling 'find_subset' from 'parse_feature_ids_or_subset'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:368:38: return_function: returning to 'parse_feature_ids_or_subset' from 'find_subset'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:369:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:374:15: branch_false: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:376:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:377:13: branch_true: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:377:13: danger: 'fsref' could be NULL: unchecked value from [(2)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/1)
#  375|            ok = any_one_byte_hex_string_to_byte_in_buf(val, &feature_hexid);
#  376|            if (ok) {
#  377|->             fsref->subset = VCP_SUBSET_SINGLE_FEATURE;
#  378|               // fsref->specific_feature = feature_hexid;
#  379|               fsref->features = bs256_insert(fsref->features, feature_hexid);     // for future

Error: GCC_ANALYZER_WARNING (CWE-401): [#def220]
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:379:31: warning[-Wanalyzer-malloc-leak]: leak of 'fsref'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:360:19: enter_function: entry to 'parse_feature_ids_or_subset'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:364:30: acquire_memory: allocated here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:366:7: branch_true: following 'true' branch (when 'vals_ct <= 1')...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:367:20: branch_true: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:368:38: call_function: calling 'find_subset' from 'parse_feature_ids_or_subset'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:368:38: return_function: returning to 'parse_feature_ids_or_subset' from 'find_subset'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:369:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:374:15: branch_false: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:376:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:377:13: branch_true: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:379:31: danger: 'fsref' leaks here; was allocated at [(2)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/1)
#  377|               fsref->subset = VCP_SUBSET_SINGLE_FEATURE;
#  378|               // fsref->specific_feature = feature_hexid;
#  379|->             fsref->features = bs256_insert(fsref->features, feature_hexid);     // for future
#  380|            }
#  381|         }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def221]
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:389:15: warning[-Wanalyzer-malloc-leak]: leak of 'fsref'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:364:30: acquire_memory: allocated here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:366:7: branch_false: following 'false' branch (when 'vals_ct > 1')...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:385:7: branch_false: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:385:7: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:387:25: branch_true: following 'true' branch (when 'ndx < vals_ct')...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:388:15: branch_true: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:389:15: danger: 'fsref' leaks here; was allocated at [(1)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/0)
#  387|         for (int ndx = 0; ndx < vals_ct; ndx++) {
#  388|            Byte feature_hexid = 0;   // temp
#  389|->          ok = any_one_byte_hex_string_to_byte_in_buf(vals[ndx], &feature_hexid);
#  390|            DBGMSF(debug, "vals[ndx]=%s, ok=%s, feature_hexid=0x%02x", vals[ndx], sbool(ok), feature_hexid);
#  391|            if (ok) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def222]
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:392:31: warning[-Wanalyzer-malloc-leak]: leak of 'fsref'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:364:30: acquire_memory: allocated here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:366:7: branch_false: following 'false' branch (when 'vals_ct > 1')...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:385:7: branch_false: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:385:7: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:387:25: branch_true: following 'true' branch (when 'ndx < vals_ct')...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:388:15: branch_true: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:391:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:392:31: branch_true: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:392:31: danger: 'fsref' leaks here; was allocated at [(1)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/0)
#  390|            DBGMSF(debug, "vals[ndx]=%s, ok=%s, feature_hexid=0x%02x", vals[ndx], sbool(ok), feature_hexid);
#  391|            if (ok) {
#  392|->             fsref->features = bs256_insert(fsref->features, feature_hexid);
#  393|            }
#  394|         }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def223]
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:392:31: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'fsref'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:364:30: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:366:7: branch_false: following 'false' branch (when 'vals_ct > 1')...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:385:7: branch_false: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:385:7: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:387:25: branch_true: following 'true' branch (when 'ndx < vals_ct')...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:388:15: branch_true: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:391:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:392:31: branch_true: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:392:31: danger: 'fsref' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/0)
#  390|            DBGMSF(debug, "vals[ndx]=%s, ok=%s, feature_hexid=0x%02x", vals[ndx], sbool(ok), feature_hexid);
#  391|            if (ok) {
#  392|->             fsref->features = bs256_insert(fsref->features, feature_hexid);
#  393|            }
#  394|         }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def224]
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:431:7: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:430:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:431:7: branch_true: ...to here
ddcutil-2.2.1/src/cmdline/cmd_parser_aux.c:431:7: danger: dereference of NULL 'get_command((int)*parsed_cmd.cmd_id)'
#  429|      }
#  430|      if (!(parsed_cmd->output_level & valid_output_levels)) {
#  431|->       printf("Output level invalid for command %s: %s\n",
#  432|                get_command(parsed_cmd->cmd_id)->cmd_name,
#  433|                output_level_name(parsed_cmd->output_level) );

Error: CPPCHECK_WARNING (CWE-476): [#def225]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:119: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_cmd
#  117|      // DBGMSG("Starting. file=%s", __FILE__);
#  118|      Parsed_Cmd * parsed_cmd = calloc(1, sizeof(Parsed_Cmd));
#  119|->    memcpy(parsed_cmd->marker, PARSED_CMD_MARKER, 4);
#  120|      // n. all flags are false, byte values 0, integers 0, pointers NULL because of calloc
#  121|      // parsed_cmd->output_level = OL_DEFAULT;

Error: CPPCHECK_WARNING (CWE-476): [#def226]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:122: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_cmd
#  120|      // n. all flags are false, byte values 0, integers 0, pointers NULL because of calloc
#  121|      // parsed_cmd->output_level = OL_DEFAULT;
#  122|->    parsed_cmd->output_level = DDCA_OL_NORMAL;
#  123|      parsed_cmd->edid_read_size = -1;   // if set, values are >= 0
#  124|      parsed_cmd->sleep_multiplier = 1.0;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def227]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:122:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'parsed_cmd'
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:118:30: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:122:4: danger: 'parsed_cmd' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  120|      // n. all flags are false, byte values 0, integers 0, pointers NULL because of calloc
#  121|      // parsed_cmd->output_level = OL_DEFAULT;
#  122|->    parsed_cmd->output_level = DDCA_OL_NORMAL;
#  123|      parsed_cmd->edid_read_size = -1;   // if set, values are >= 0
#  124|      parsed_cmd->sleep_multiplier = 1.0;

Error: CPPCHECK_WARNING (CWE-476): [#def228]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:123: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_cmd
#  121|      // parsed_cmd->output_level = OL_DEFAULT;
#  122|      parsed_cmd->output_level = DDCA_OL_NORMAL;
#  123|->    parsed_cmd->edid_read_size = -1;   // if set, values are >= 0
#  124|      parsed_cmd->sleep_multiplier = 1.0;
#  125|      parsed_cmd->min_dynamic_multiplier = -1.0;

Error: CPPCHECK_WARNING (CWE-476): [#def229]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:124: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_cmd
#  122|      parsed_cmd->output_level = DDCA_OL_NORMAL;
#  123|      parsed_cmd->edid_read_size = -1;   // if set, values are >= 0
#  124|->    parsed_cmd->sleep_multiplier = 1.0;
#  125|      parsed_cmd->min_dynamic_multiplier = -1.0;
#  126|      parsed_cmd->i2c_bus_check_async_min = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def230]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:125: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_cmd
#  123|      parsed_cmd->edid_read_size = -1;   // if set, values are >= 0
#  124|      parsed_cmd->sleep_multiplier = 1.0;
#  125|->    parsed_cmd->min_dynamic_multiplier = -1.0;
#  126|      parsed_cmd->i2c_bus_check_async_min = -1;
#  127|      parsed_cmd->ddc_check_async_min = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def231]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:126: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_cmd
#  124|      parsed_cmd->sleep_multiplier = 1.0;
#  125|      parsed_cmd->min_dynamic_multiplier = -1.0;
#  126|->    parsed_cmd->i2c_bus_check_async_min = -1;
#  127|      parsed_cmd->ddc_check_async_min = -1;
#  128|      parsed_cmd->i1 = -1;               // if set, values are >= 0

Error: CPPCHECK_WARNING (CWE-476): [#def232]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:127: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_cmd
#  125|      parsed_cmd->min_dynamic_multiplier = -1.0;
#  126|      parsed_cmd->i2c_bus_check_async_min = -1;
#  127|->    parsed_cmd->ddc_check_async_min = -1;
#  128|      parsed_cmd->i1 = -1;               // if set, values are >= 0
#  129|   #ifdef OLD

Error: CPPCHECK_WARNING (CWE-476): [#def233]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:128: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_cmd
#  126|      parsed_cmd->i2c_bus_check_async_min = -1;
#  127|      parsed_cmd->ddc_check_async_min = -1;
#  128|->    parsed_cmd->i1 = -1;               // if set, values are >= 0
#  129|   #ifdef OLD
#  130|      parsed_cmd->flags |= CMD_FLAG_NODETECT;

Error: CPPCHECK_WARNING (CWE-476): [#def234]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:132: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_cmd
#  130|      parsed_cmd->flags |= CMD_FLAG_NODETECT;
#  131|   #endif
#  132|->    parsed_cmd->setvcp_values = g_array_new(false,         // not null-terminated
#  133|                                              true,          // clear to 0's
#  134|                                              sizeof(Parsed_Setvcp_Args));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def235]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:132:32: warning[-Wanalyzer-malloc-leak]: leak of 'parsed_cmd'
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:118:30: acquire_memory: allocated here
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:132:32: danger: 'parsed_cmd' leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  130|      parsed_cmd->flags |= CMD_FLAG_NODETECT;
#  131|   #endif
#  132|->    parsed_cmd->setvcp_values = g_array_new(false,         // not null-terminated
#  133|                                              true,          // clear to 0's
#  134|                                              sizeof(Parsed_Setvcp_Args));

Error: CPPCHECK_WARNING (CWE-476): [#def236]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:135: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_cmd
#  133|                                              true,          // clear to 0's
#  134|                                              sizeof(Parsed_Setvcp_Args));
#  135|->    g_array_set_clear_func(parsed_cmd->setvcp_values, destroy_parsed_setvcp_value);
#  136|      if (DEFAULT_ENABLE_UDF)
#  137|         parsed_cmd->flags |= CMD_FLAG_ENABLE_UDF;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def237]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:135:4: warning[-Wanalyzer-malloc-leak]: leak of 'parsed_cmd'
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:118:30: acquire_memory: allocated here
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:135:4: danger: 'parsed_cmd' leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  133|                                              true,          // clear to 0's
#  134|                                              sizeof(Parsed_Setvcp_Args));
#  135|->    g_array_set_clear_func(parsed_cmd->setvcp_values, destroy_parsed_setvcp_value);
#  136|      if (DEFAULT_ENABLE_UDF)
#  137|         parsed_cmd->flags |= CMD_FLAG_ENABLE_UDF;

Error: CPPCHECK_WARNING (CWE-476): [#def238]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:137: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_cmd
#  135|      g_array_set_clear_func(parsed_cmd->setvcp_values, destroy_parsed_setvcp_value);
#  136|      if (DEFAULT_ENABLE_UDF)
#  137|->       parsed_cmd->flags |= CMD_FLAG_ENABLE_UDF;
#  138|   #ifdef ENABLE_USB
#  139|      if (DEFAULT_ENABLE_USB)

Error: CPPCHECK_WARNING (CWE-476): [#def239]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:143: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_cmd
#  141|   #endif
#  142|      if (DEFAULT_ENABLE_CACHED_CAPABILITIES)
#  143|->       parsed_cmd->flags |= CMD_FLAG_ENABLE_CACHED_CAPABILITIES;
#  144|   
#  145|      // parsed_cmd->watch_mode = Watch_Mode_Dynamic;

Error: CPPCHECK_WARNING (CWE-476): [#def240]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:146: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_cmd
#  144|   
#  145|      // parsed_cmd->watch_mode = Watch_Mode_Dynamic;
#  146|->    parsed_cmd->xevent_watch_loop_millisec = DEFAULT_XEVENT_WATCH_LOOP_MILLISEC;
#  147|      parsed_cmd->poll_watch_loop_millisec   = DEFAULT_POLL_WATCH_LOOP_MILLISEC;
#  148|      return parsed_cmd;

Error: CPPCHECK_WARNING (CWE-476): [#def241]
ddcutil-2.2.1/src/cmdline/parsed_cmd.c:147: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_cmd
#  145|      // parsed_cmd->watch_mode = Watch_Mode_Dynamic;
#  146|      parsed_cmd->xevent_watch_loop_millisec = DEFAULT_XEVENT_WATCH_LOOP_MILLISEC;
#  147|->    parsed_cmd->poll_watch_loop_millisec   = DEFAULT_POLL_WATCH_LOOP_MILLISEC;
#  148|      return parsed_cmd;
#  149|   }

Error: CPPCHECK_WARNING (CWE-476): [#def242]
ddcutil-2.2.1/src/ddc/ddc_display_ref_reports.c:567: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  565|      if (!result) {
#  566|         result = calloc(1, sizeof(EDID_Use_Record));
#  567|->       result->edid = edid;
#  568|         DBGTRC_DONE(debug, DDCA_TRC_NONE, "Returning new EDID_Use_Record %p for edid %s",
#  569|                       result, hexstring_t(edid+122,6) );

Error: GCC_ANALYZER_WARNING (CWE-476): [#def243]
ddcutil-2.2.1/src/ddc/ddc_display_ref_reports.c:567:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/ddc/ddc_display_ref_reports.c:550:4: branch_false: following 'false' branch (when 'edid' is non-NULL)...
ddcutil-2.2.1/src/ddc/ddc_display_ref_reports.c:552:4: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_display_ref_reports.c:565:7: branch_true: following 'true' branch (when 'result' is NULL)...
ddcutil-2.2.1/src/ddc/ddc_display_ref_reports.c:566:16: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_display_ref_reports.c:566:16: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/ddc/ddc_display_ref_reports.c:567:7: danger: 'result' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
#  565|      if (!result) {
#  566|         result = calloc(1, sizeof(EDID_Use_Record));
#  567|->       result->edid = edid;
#  568|         DBGTRC_DONE(debug, DDCA_TRC_NONE, "Returning new EDID_Use_Record %p for edid %s",
#  569|                       result, hexstring_t(edid+122,6) );

Error: GCC_ANALYZER_WARNING (CWE-401): [#def244]
ddcutil-2.2.1/src/ddc/ddc_display_ref_reports.c:568:7: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/ddc/ddc_display_ref_reports.c:550:4: branch_false: following 'false' branch (when 'edid' is non-NULL)...
ddcutil-2.2.1/src/ddc/ddc_display_ref_reports.c:552:4: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_display_ref_reports.c:565:7: branch_true: following 'true' branch (when 'result' is NULL)...
ddcutil-2.2.1/src/ddc/ddc_display_ref_reports.c:566:16: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_display_ref_reports.c:566:16: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_display_ref_reports.c:568:7: danger: 'result' leaks here; was allocated at [(5)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/4)
#  566|         result = calloc(1, sizeof(EDID_Use_Record));
#  567|         result->edid = edid;
#  568|->       DBGTRC_DONE(debug, DDCA_TRC_NONE, "Returning new EDID_Use_Record %p for edid %s",
#  569|                       result, hexstring_t(edid+122,6) );
#  570|         g_ptr_array_add(records, result);

Error: CPPCHECK_WARNING (CWE-476): [#def245]
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:69: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: criteria
#   67|      DBGMSF(debug, "Starting");
#   68|      Display_Criteria * criteria = calloc(1, sizeof(Display_Criteria));
#   69|->    criteria->dispno = -1;
#   70|      criteria->i2c_busno  = -1;
#   71|      criteria->hiddev = -1;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def246]
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:69:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'criteria'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:203:1: enter_function: entry to 'ddc_find_display_ref_by_display_identifier'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:211:34: call_function: calling 'new_display_criteria' from 'ddc_find_display_ref_by_display_identifier'
#   67|      DBGMSF(debug, "Starting");
#   68|      Display_Criteria * criteria = calloc(1, sizeof(Display_Criteria));
#   69|->    criteria->dispno = -1;
#   70|      criteria->i2c_busno  = -1;
#   71|      criteria->hiddev = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def247]
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:70: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: criteria
#   68|      Display_Criteria * criteria = calloc(1, sizeof(Display_Criteria));
#   69|      criteria->dispno = -1;
#   70|->    criteria->i2c_busno  = -1;
#   71|      criteria->hiddev = -1;
#   72|      criteria->usb_busno = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def248]
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:71: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: criteria
#   69|      criteria->dispno = -1;
#   70|      criteria->i2c_busno  = -1;
#   71|->    criteria->hiddev = -1;
#   72|      criteria->usb_busno = -1;
#   73|      criteria->usb_devno = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def249]
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:72: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: criteria
#   70|      criteria->i2c_busno  = -1;
#   71|      criteria->hiddev = -1;
#   72|->    criteria->usb_busno = -1;
#   73|      criteria->usb_devno = -1;
#   74|      DBGMSF(debug, "Done.    Returning: %p", criteria);

Error: CPPCHECK_WARNING (CWE-476): [#def250]
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:73: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: criteria
#   71|      criteria->hiddev = -1;
#   72|      criteria->usb_busno = -1;
#   73|->    criteria->usb_devno = -1;
#   74|      DBGMSF(debug, "Done.    Returning: %p", criteria);
#   75|      return criteria;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def251]
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:108:7: warning[-Wanalyzer-malloc-leak]: leak of 'new_display_criteria()'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:203:1: enter_function: entry to 'ddc_find_display_ref_by_display_identifier'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:211:34: call_function: calling 'new_display_criteria' from 'ddc_find_display_ref_by_display_identifier'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:211:34: return_function: returning to 'ddc_find_display_ref_by_display_identifier' from 'new_display_criteria'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:236:13: call_function: calling 'ddc_find_display_ref_by_criteria' from 'ddc_find_display_ref_by_display_identifier'
#  106|            goto bye;
#  107|         char buf[40];
#  108|->       snprintf(buf, 40, "%s/hiddev%d", usb_hiddev_directory(), criteria->hiddev);
#  109|         Usb_Monitor_Info * moninfo = dref->detail;
#  110|         TRACED_ASSERT(memcmp(moninfo->marker, USB_MONITOR_INFO_MARKER, 4) == 0);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def252]
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:110:7: warning[-Wanalyzer-malloc-leak]: leak of 'new_display_criteria()'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:203:1: enter_function: entry to 'ddc_find_display_ref_by_display_identifier'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:211:34: call_function: calling 'new_display_criteria' from 'ddc_find_display_ref_by_display_identifier'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:211:34: return_function: returning to 'ddc_find_display_ref_by_display_identifier' from 'new_display_criteria'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:236:13: call_function: calling 'ddc_find_display_ref_by_criteria' from 'ddc_find_display_ref_by_display_identifier'
#  108|         snprintf(buf, 40, "%s/hiddev%d", usb_hiddev_directory(), criteria->hiddev);
#  109|         Usb_Monitor_Info * moninfo = dref->detail;
#  110|->       TRACED_ASSERT(memcmp(moninfo->marker, USB_MONITOR_INFO_MARKER, 4) == 0);
#  111|         if (!streq( moninfo->hiddev_device_name, buf))
#  112|            goto bye;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def253]
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:174:31: warning[-Wanalyzer-malloc-leak]: leak of 'new_display_criteria()'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:203:1: enter_function: entry to 'ddc_find_display_ref_by_display_identifier'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:211:34: call_function: calling 'new_display_criteria' from 'ddc_find_display_ref_by_display_identifier'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:211:34: return_function: returning to 'ddc_find_display_ref_by_display_identifier' from 'new_display_criteria'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:236:13: call_function: calling 'ddc_find_display_ref_by_criteria' from 'ddc_find_display_ref_by_display_identifier'
#  172|   ddc_find_display_ref_by_criteria(Display_Criteria * criteria) {
#  173|      Display_Ref * result = NULL;
#  174|->    GPtrArray * all_displays = ddc_get_all_display_refs();
#  175|      for (int ndx = 0; ndx < all_displays->len; ndx++) {
#  176|         Display_Ref * drec = g_ptr_array_index(all_displays, ndx);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def254]
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:177:7: warning[-Wanalyzer-malloc-leak]: leak of 'new_display_criteria()'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:203:1: enter_function: entry to 'ddc_find_display_ref_by_display_identifier'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:211:34: call_function: calling 'new_display_criteria' from 'ddc_find_display_ref_by_display_identifier'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:211:34: return_function: returning to 'ddc_find_display_ref_by_display_identifier' from 'new_display_criteria'
ddcutil-2.2.1/src/ddc/ddc_display_selection.c:236:13: call_function: calling 'ddc_find_display_ref_by_criteria' from 'ddc_find_display_ref_by_display_identifier'
#  175|      for (int ndx = 0; ndx < all_displays->len; ndx++) {
#  176|         Display_Ref * drec = g_ptr_array_index(all_displays, ndx);
#  177|->       TRACED_ASSERT(memcmp(drec->marker, DISPLAY_REF_MARKER, 4) == 0);
#  178|         if (ddc_test_display_ref_criteria(drec, criteria)) {
#  179|            // Ignore the match if it's a phantom display

Error: CPPCHECK_WARNING (CWE-476): [#def255]
ddcutil-2.2.1/src/ddc/ddc_displays.c:448: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: boe
#  446|         else if ( !(businfo->flags & I2C_BUS_ACCESSIBLE) ) {
#  447|            Bus_Open_Error * boe = calloc(1, sizeof(Bus_Open_Error));
#  448|->          boe->io_mode = DDCA_IO_I2C;
#  449|            boe->devno = businfo->busno;
#  450|            boe->error = businfo->open_errno;

Error: CPPCHECK_WARNING (CWE-476): [#def256]
ddcutil-2.2.1/src/ddc/ddc_displays.c:449: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: boe
#  447|            Bus_Open_Error * boe = calloc(1, sizeof(Bus_Open_Error));
#  448|            boe->io_mode = DDCA_IO_I2C;
#  449|->          boe->devno = businfo->busno;
#  450|            boe->error = businfo->open_errno;
#  451|            g_ptr_array_add(bus_open_errors, boe);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def257]
ddcutil-2.2.1/src/ddc/ddc_displays.c:449:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'boe'
ddcutil-2.2.1/src/ddc/ddc_displays.c:391:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_displays.c:393:32: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_displays.c:396:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_displays.c:446:19: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_displays.c:446:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_displays.c:447:33: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_displays.c:447:33: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/ddc/ddc_displays.c:449:10: danger: 'boe' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#  447|            Bus_Open_Error * boe = calloc(1, sizeof(Bus_Open_Error));
#  448|            boe->io_mode = DDCA_IO_I2C;
#  449|->          boe->devno = businfo->busno;
#  450|            boe->error = businfo->open_errno;
#  451|            g_ptr_array_add(bus_open_errors, boe);

Error: CPPCHECK_WARNING (CWE-476): [#def258]
ddcutil-2.2.1/src/ddc/ddc_displays.c:450: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: boe
#  448|            boe->io_mode = DDCA_IO_I2C;
#  449|            boe->devno = businfo->busno;
#  450|->          boe->error = businfo->open_errno;
#  451|            g_ptr_array_add(bus_open_errors, boe);
#  452|         }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def259]
ddcutil-2.2.1/src/ddc/ddc_displays.c:451:10: warning[-Wanalyzer-malloc-leak]: leak of 'boe'
ddcutil-2.2.1/src/ddc/ddc_displays.c:391:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_displays.c:393:32: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_displays.c:396:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_displays.c:446:19: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_displays.c:446:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_displays.c:447:33: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_displays.c:447:33: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_displays.c:451:10: danger: 'boe' leaks here; was allocated at [(7)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/6)
#  449|            boe->devno = businfo->busno;
#  450|            boe->error = businfo->open_errno;
#  451|->          g_ptr_array_add(bus_open_errors, boe);
#  452|         }
#  453|      }

Error: CPPCHECK_WARNING (CWE-476): [#def260]
ddcutil-2.2.1/src/ddc/ddc_displays.c:523: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: boe_copy
#  521|               Bus_Open_Error * usb_boe = (Bus_Open_Error *) g_ptr_array_index(usb_open_errors, ndx);
#  522|               Bus_Open_Error * boe_copy = calloc(1, sizeof(Bus_Open_Error));
#  523|->             boe_copy->io_mode = DDCA_IO_USB;
#  524|               boe_copy->devno   = usb_boe->devno;
#  525|               boe_copy->error   = usb_boe->error;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def261]
ddcutil-2.2.1/src/ddc/ddc_displays.c:523:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'boe_copy'
ddcutil-2.2.1/src/ddc/ddc_displays.c:456:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_displays.c:457:34: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_displays.c:519:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_displays.c:520:28: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_displays.c:521:59: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_displays.c:522:41: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/ddc/ddc_displays.c:523:13: danger: 'boe_copy' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/6)
#  521|               Bus_Open_Error * usb_boe = (Bus_Open_Error *) g_ptr_array_index(usb_open_errors, ndx);
#  522|               Bus_Open_Error * boe_copy = calloc(1, sizeof(Bus_Open_Error));
#  523|->             boe_copy->io_mode = DDCA_IO_USB;
#  524|               boe_copy->devno   = usb_boe->devno;
#  525|               boe_copy->error   = usb_boe->error;

Error: CPPCHECK_WARNING (CWE-476): [#def262]
ddcutil-2.2.1/src/ddc/ddc_displays.c:524: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: boe_copy
#  522|               Bus_Open_Error * boe_copy = calloc(1, sizeof(Bus_Open_Error));
#  523|               boe_copy->io_mode = DDCA_IO_USB;
#  524|->             boe_copy->devno   = usb_boe->devno;
#  525|               boe_copy->error   = usb_boe->error;
#  526|               boe_copy->detail  = usb_boe->detail;

Error: CPPCHECK_WARNING (CWE-476): [#def263]
ddcutil-2.2.1/src/ddc/ddc_displays.c:525: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: boe_copy
#  523|               boe_copy->io_mode = DDCA_IO_USB;
#  524|               boe_copy->devno   = usb_boe->devno;
#  525|->             boe_copy->error   = usb_boe->error;
#  526|               boe_copy->detail  = usb_boe->detail;
#  527|               g_ptr_array_add(bus_open_errors, boe_copy);

Error: CPPCHECK_WARNING (CWE-476): [#def264]
ddcutil-2.2.1/src/ddc/ddc_displays.c:526: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: boe_copy
#  524|               boe_copy->devno   = usb_boe->devno;
#  525|               boe_copy->error   = usb_boe->error;
#  526|->             boe_copy->detail  = usb_boe->detail;
#  527|               g_ptr_array_add(bus_open_errors, boe_copy);
#  528|            }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def265]
ddcutil-2.2.1/src/ddc/ddc_displays.c:527:13: warning[-Wanalyzer-malloc-leak]: leak of 'boe_copy'
ddcutil-2.2.1/src/ddc/ddc_displays.c:456:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_displays.c:457:34: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_displays.c:519:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_displays.c:520:28: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_displays.c:521:59: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_displays.c:522:41: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_displays.c:527:13: danger: 'boe_copy' leaks here; was allocated at [(7)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/6)
#  525|               boe_copy->error   = usb_boe->error;
#  526|               boe_copy->detail  = usb_boe->detail;
#  527|->             g_ptr_array_add(bus_open_errors, boe_copy);
#  528|            }
#  529|         }

Error: CPPCHECK_WARNING (CWE-476): [#def266]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:130: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: data
#  128|   #endif
#  129|      // default:
#  130|->    data->vcp_version.major = 2;
#  131|      data->vcp_version.minor = 0;
#  132|      data->vcp_values = vcp_value_set_new(15);      // 15 = initial size

Error: CPPCHECK_WARNING (CWE-476): [#def267]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:131: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: data
#  129|      // default:
#  130|      data->vcp_version.major = 2;
#  131|->    data->vcp_version.minor = 0;
#  132|      data->vcp_values = vcp_value_set_new(15);      // 15 = initial size
#  133|   

Error: CPPCHECK_WARNING (CWE-476): [#def268]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:132: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: data
#  130|      data->vcp_version.major = 2;
#  131|      data->vcp_version.minor = 0;
#  132|->    data->vcp_values = vcp_value_set_new(15);      // 15 = initial size
#  133|   
#  134|      int     ct;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def269]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:132:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:132:4: danger: 'data' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  130|      data->vcp_version.major = 2;
#  131|      data->vcp_version.minor = 0;
#  132|->    data->vcp_values = vcp_value_set_new(15);      // 15 = initial size
#  133|   
#  134|      int     ct;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def270]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:132:23: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:132:23: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  130|      data->vcp_version.major = 2;
#  131|      data->vcp_version.minor = 0;
#  132|->    data->vcp_values = vcp_value_set_new(15);      // 15 = initial size
#  133|   
#  134|      int     ct;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def271]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:157:13: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_true: following 'true' branch (when 'ct == 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:157:13: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:157:13: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  155|               //                       "Invalid data at line %d: %s", linectr, line);
#  156|               // errinfo_add_cause(errs, err);
#  157|->             ADD_DATA_ERROR("Invalid data");
#  158|   #ifndef NDEBUG
#  159|               valid_data = false;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def272]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0)
#  170|               // DBGMSG("rest=|%s|", rest );
#  171|   
#  172|->             if (streq(s0, "BUS")) {
#  173|                  // ignore
#  174|                  // ct = sscanf(s1, "%d", &data->busno);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def273]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0)
#  178|                  // }
#  179|               }
#  180|->             else if (streq(s0, "PRODUCT_CODE")) {
#  181|                  int ival;
#  182|                  bool ok = str_to_int(s1, &ival, 10);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def274]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:182:26: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:182:26: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:182:26: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/0)
#  180|               else if (streq(s0, "PRODUCT_CODE")) {
#  181|                  int ival;
#  182|->                bool ok = str_to_int(s1, &ival, 10);
#  183|                  if (ok && ival >= 0 && ival <= 65535)
#  184|                     data->product_code = (uint16_t) ival;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def275]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/0)
#  188|   #endif
#  189|               }
#  190|->             else if (streq(s0, "EDID") || streq(s0, "EDIDSTR")) {
#  191|                  STRLCPY(data->edidstr, s1, sizeof(data->edidstr));
#  192|               }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def276]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:43: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:43: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:43: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/0)
#  188|   #endif
#  189|               }
#  190|->             else if (streq(s0, "EDID") || streq(s0, "EDIDSTR")) {
#  191|                  STRLCPY(data->edidstr, s1, sizeof(data->edidstr));
#  192|               }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def277]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:22: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:22: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/0)
#  191|                  STRLCPY(data->edidstr, s1, sizeof(data->edidstr));
#  192|               }
#  193|->             else if (streq(s0, "MFG_ID")) {
#  194|                  STRLCPY(data->mfg_id, s1, sizeof(data->mfg_id));
#  195|               }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def278]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/0)
#  194|                  STRLCPY(data->mfg_id, s1, sizeof(data->mfg_id));
#  195|               }
#  196|->             else if (streq(s0, "MODEL")) {
#  197|                  STRLCPY(data->model, rest, sizeof(data->model));
#  198|               }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def279]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/0)
#  197|                  STRLCPY(data->model, rest, sizeof(data->model));
#  198|               }
#  199|->             else if (streq(s0, "SN")) {
#  200|                  STRLCPY(data->serial_ascii, rest, sizeof(data->serial_ascii));
#  201|               }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def280]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/0)
#  200|                  STRLCPY(data->serial_ascii, rest, sizeof(data->serial_ascii));
#  201|               }
#  202|->             else if (streq(s0, "VCP_VERSION")) {
#  203|                  data->vcp_version = parse_vspec(s1);
#  204|                  // using VCP_SPEC_UNKNOWN as value when invalid,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def281]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:203:36: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:203:36: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:203:36: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/0)
#  201|               }
#  202|               else if (streq(s0, "VCP_VERSION")) {
#  203|->                data->vcp_version = parse_vspec(s1);
#  204|                  // using VCP_SPEC_UNKNOWN as value when invalid,
#  205|                  // what if monitor had no version, so 0.0 was output?

Error: GCC_ANALYZER_WARNING (CWE-401): [#def282]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:206:21: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:203:36: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:206:21: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/0)
#  204|                  // using VCP_SPEC_UNKNOWN as value when invalid,
#  205|                  // what if monitor had no version, so 0.0 was output?
#  206|->                if ( vcp_version_eq( data->vcp_version, DDCA_VSPEC_UNKNOWN) ) {
#  207|                     // f0printf(ferr(), "Invalid VCP VERSION at line %d: %s\n", linectr, line);
#  208|                     // errinfo_add_cause(

Error: GCC_ANALYZER_WARNING (CWE-401): [#def283]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:213:19: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:203:36: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:206:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:213:19: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:213:19: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/15/codeFlows/0/threadFlows/0/locations/0)
#  211|                     //                  DDCRC_BAD_DATA, __func__,
#  212|                     //                  "Invalid VCP VERSION at line %d: %s\n", linectr, line) );
#  213|->                   ADD_DATA_ERROR("Invalid VCP VERSION");
#  214|   #ifndef NDEBUG
#  215|                     valid_data = false;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def284]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/0)
#  217|                  }
#  218|               }
#  219|->             else if (streq(s0, "TIMESTAMP_TEXT")   ||
#  220|                        streq(s0, "TIMESTAMP_MILLIS")
#  221|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def285]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/0)
#  218|               }
#  219|               else if (streq(s0, "TIMESTAMP_TEXT")   ||
#  220|->                      streq(s0, "TIMESTAMP_MILLIS")
#  221|   
#  222|                       ) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def286]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/0)
#  223|                  // do nothing, just recognize valid field
#  224|               }
#  225|->             else if (streq(s0, "VCP")) {
#  226|                  if (ct != 3) {
#  227|                     // f0printf(ferr(), "Invalid VCP data at line %d: %s\n", linectr, line);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def287]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:228:19: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_true: following 'true' branch (when 'ct != 3')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:228:19: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:228:19: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/20/codeFlows/0/threadFlows/0/locations/0)
#  226|                  if (ct != 3) {
#  227|                     // f0printf(ferr(), "Invalid VCP data at line %d: %s\n", linectr, line);
#  228|->                   ADD_DATA_ERROR("Invalid VCP data");
#  229|   #ifndef NDEBUG
#  230|                     valid_data = false;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def288]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:235:29: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_false: following 'false' branch (when 'ct == 3')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:235:29: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:235:29: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/22/codeFlows/0/threadFlows/0/locations/0)
#  233|                  else {   // found feature id and value
#  234|                     Byte feature_id;
#  235|->                   bool ok = hhs_to_byte_in_buf(s1, &feature_id);
#  236|                     if (!ok) {
#  237|                        // f0printf(ferr(), "Invalid opcode at line %d: %s", linectr, s1);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def289]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:238:22: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_false: following 'false' branch (when 'ct == 3')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:235:29: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:236:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:238:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:238:22: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/0)
#  236|                     if (!ok) {
#  237|                        // f0printf(ferr(), "Invalid opcode at line %d: %s", linectr, s1);
#  238|->                      ADD_DATA_ERROR("Invalid  opcode");
#  239|   #ifndef NDEBUG
#  240|                        valid_data = false;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def290]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:254:46: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_false: following 'false' branch (when 'ct == 3')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:235:29: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:236:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:254:46: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:254:46: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/25/codeFlows/0/threadFlows/0/locations/0)
#  252|                        // second solution: vcp version in dumpload data
#  253|   
#  254|->                      Monitor_Model_Key mmk = mmk_value(
#  255|                              data->mfg_id, data->model, data->product_code);
#  256|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def291]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:258:47: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_false: following 'false' branch (when 'ct == 3')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:235:29: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:236:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:254:46: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:258:47: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/26/codeFlows/0/threadFlows/0/locations/0)
#  256|   
#  257|                        Display_Feature_Metadata * dfm =
#  258|->                                               dyn_get_feature_metadata_by_mmk_and_vspec(
#  259|                                                      feature_id,
#  260|                                                      mmk,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def292]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:269:39: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_false: following 'false' branch (when 'ct == 3')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:235:29: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:236:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:254:46: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:266:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:269:39: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:269:39: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/27/codeFlows/0/threadFlows/0/locations/0)
#  267|                           // s2 is hex string
#  268|                           Byte * ba;
#  269|->                         int bytect =  hhs_to_byte_array(s2, &ba);
#  270|                           if (bytect < 0) {
#  271|                              // f0printf(ferr(),

Error: GCC_ANALYZER_WARNING (CWE-401): [#def293]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:274:28: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_false: following 'false' branch (when 'ct == 3')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:235:29: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:236:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:254:46: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:266:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:269:39: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:270:28: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:274:28: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:274:28: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/28/codeFlows/0/threadFlows/0/locations/0)
#  272|                              //          "Invalid hex string value for opcode at line %d: %s\n",
#  273|                              //          linectr, line);
#  274|->                            ADD_DATA_ERROR("Invalid hex string value for opcode");
#  275|   #ifndef NDEBUG
#  276|                              valid_data = false;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def294]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:280:37: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_false: following 'false' branch (when 'ct == 3')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:235:29: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:236:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:254:46: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:266:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:269:39: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:270:28: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:280:37: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:280:37: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/30/codeFlows/0/threadFlows/0/locations/0)
#  278|                           }
#  279|                           else {
#  280|->                            valrec = create_table_vcp_value_by_bytes(
#  281|                                    feature_id,
#  282|                                    ba,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def295]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:292:28: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_false: following 'false' branch (when 'ct == 3')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:235:29: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:236:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:254:46: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:266:25: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:289:30: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:290:28: branch_true: following 'true' branch (when 'ct == 0')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:292:28: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:292:28: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/31/codeFlows/0/threadFlows/0/locations/0)
#  290|                           if (ct == 0) {
#  291|                              // f0printf(ferr(), "Invalid value for opcode at line %d: %s\n", linectr, line);
#  292|->                            ADD_DATA_ERROR("Invalid value for opcode");
#  293|   #ifndef NDEBUG
#  294|                              valid_data = false;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def296]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:300:37: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_false: following 'false' branch (when 'ct == 3')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:235:29: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:236:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:254:46: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:266:25: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:289:30: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:290:28: branch_false: following 'false' branch (when 'ct != 0')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:300:37: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:300:37: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/33/codeFlows/0/threadFlows/0/locations/0)
#  298|                              // good opcode and value
#  299|                              // TODO: opcode and value should be saved in local vars
#  300|->                            valrec = create_cont_vcp_value(
#  301|                                 feature_id,
#  302|                                 0,   // max_val, unused for LOADVCP

Error: GCC_ANALYZER_WARNING (CWE-401): [#def297]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:308:25: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_false: following 'false' branch (when 'ct == 3')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:235:29: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:236:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:254:46: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:290:28: branch_false: following 'false' branch (when 'ct != 0')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:300:37: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:306:25: branch_true: following 'true' branch (when 'valrec' is non-NULL)...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:307:25: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:308:25: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/34/codeFlows/0/threadFlows/0/locations/0)
#  306|                        if (valrec) {
#  307|                           data->vcp_value_ct++;
#  308|->                         vcp_value_set_add(data->vcp_values, valrec);
#  309|                        }
#  310|                        dfm_free(dfm);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def298]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:310:22: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:226:19: branch_false: following 'false' branch (when 'ct == 3')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:235:29: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:236:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:254:46: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:310:22: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/35/codeFlows/0/threadFlows/0/locations/0)
#  308|                           vcp_value_set_add(data->vcp_values, valrec);
#  309|                        }
#  310|->                      dfm_free(dfm);
#  311|                     } // valid opcode
#  312|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def299]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:318:16: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:137:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:143:14: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:150:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:151:13: branch_false: following 'false' branch (when 'ct != 1')...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:163:27: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:167:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:17: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:172:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:180:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:190:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:193:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:196:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:199:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:202:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:220:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:219:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:22: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:225:21: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:318:16: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:318:16: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/36/codeFlows/0/threadFlows/0/locations/0)
#  316|               else {
#  317|                  // f0printf(ferr(), "Unexpected field \"%s\" at line %d: %s\n", s0, linectr, line );
#  318|->                errinfo_add_cause(
#  319|                             errs,
#  320|                             errinfo_new(

Error: GCC_ANALYZER_WARNING (CWE-401): [#def300]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:334:7: warning[-Wanalyzer-malloc-leak]: leak of 'data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:125:27: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:331:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:333:8: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:333:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:334:7: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:334:7: danger: 'data' leaks here; was allocated at [(1)](sarif:/runs/0/results/38/codeFlows/0/threadFlows/0/locations/0)
#  332|              (!valid_data && errs->cause_ct >  0) );
#  333|      if (errs->cause_ct == 0) {
#  334|->       errinfo_free(errs);
#  335|         errs = NULL;
#  336|      }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def301]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:590:7: warning[-Wanalyzer-malloc-leak]: leak of 'buf'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:587:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:589:13: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:589:13: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:590:7: danger: 'buf' leaks here; was allocated at [(3)](sarif:/runs/0/results/39/codeFlows/0/threadFlows/0/locations/2)
#  588|         bufsz = 128;
#  589|         buf = calloc(1, bufsz);
#  590|->       DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "Allocated new buffer: %p", buf);
#  591|      }
#  592|      struct tm tm = *localtime(&time_millis);

Error: CPPCHECK_WARNING (CWE-476): [#def302]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:593: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
#  591|      }
#  592|      struct tm tm = *localtime(&time_millis);
#  593|->    snprintf(buf, bufsz, "%4d%02d%02d-%02d%02d%02d",
#  594|                     tm.tm_year+1900,
#  595|                     tm.tm_mon+1,

Error: CPPCHECK_WARNING (CWE-476): [#def303]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:737: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dumped_data
#  735|   
#  736|      // timestamp:
#  737|->    dumped_data->timestamp_millis = time(NULL);
#  738|   
#  739|      DBGMSF(debug, "Before get_vcp_version_by_dh()");

Error: GCC_ANALYZER_WARNING (CWE-476): [#def304]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:737:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'dumped_data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:734:34: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:737:4: danger: 'dumped_data' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/40/codeFlows/0/threadFlows/0/locations/0)
#  735|   
#  736|      // timestamp:
#  737|->    dumped_data->timestamp_millis = time(NULL);
#  738|   
#  739|      DBGMSF(debug, "Before get_vcp_version_by_dh()");

Error: CPPCHECK_WARNING (CWE-476): [#def305]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:740: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dumped_data
#  738|   
#  739|      DBGMSF(debug, "Before get_vcp_version_by_dh()");
#  740|->    dumped_data->vcp_version = get_vcp_version_by_dh(dh);  // use function to ensure set
#  741|   
#  742|      // identification information from edid:

Error: GCC_ANALYZER_WARNING (CWE-401): [#def306]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:740:31: warning[-Wanalyzer-malloc-leak]: leak of 'dumped_data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:734:34: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:740:31: danger: 'dumped_data' leaks here; was allocated at [(1)](sarif:/runs/0/results/41/codeFlows/0/threadFlows/0/locations/0)
#  738|   
#  739|      DBGMSF(debug, "Before get_vcp_version_by_dh()");
#  740|->    dumped_data->vcp_version = get_vcp_version_by_dh(dh);  // use function to ensure set
#  741|   
#  742|      // identification information from edid:

Error: CPPCHECK_WARNING (CWE-476): [#def307]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:748: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dumped_data
#  746|      DBGMSF(debug, "Have EDID");
#  747|   
#  748|->    dumped_data->product_code = edid->product_code;
#  749|      memcpy(dumped_data->mfg_id, edid->mfg_id, sizeof(dumped_data->mfg_id));
#  750|      memcpy(dumped_data->model,  edid->model_name, sizeof(dumped_data->model));

Error: CPPCHECK_WARNING (CWE-476): [#def308]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:749: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dumped_data
#  747|   
#  748|      dumped_data->product_code = edid->product_code;
#  749|->    memcpy(dumped_data->mfg_id, edid->mfg_id, sizeof(dumped_data->mfg_id));
#  750|      memcpy(dumped_data->model,  edid->model_name, sizeof(dumped_data->model));
#  751|      memcpy(dumped_data->serial_ascii, edid->serial_ascii, sizeof(dumped_data->serial_ascii));

Error: CPPCHECK_WARNING (CWE-476): [#def309]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:750: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dumped_data
#  748|      dumped_data->product_code = edid->product_code;
#  749|      memcpy(dumped_data->mfg_id, edid->mfg_id, sizeof(dumped_data->mfg_id));
#  750|->    memcpy(dumped_data->model,  edid->model_name, sizeof(dumped_data->model));
#  751|      memcpy(dumped_data->serial_ascii, edid->serial_ascii, sizeof(dumped_data->serial_ascii));
#  752|      memcpy(dumped_data->edidbytes, edid->bytes, 128);

Error: CPPCHECK_WARNING (CWE-476): [#def310]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:751: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dumped_data
#  749|      memcpy(dumped_data->mfg_id, edid->mfg_id, sizeof(dumped_data->mfg_id));
#  750|      memcpy(dumped_data->model,  edid->model_name, sizeof(dumped_data->model));
#  751|->    memcpy(dumped_data->serial_ascii, edid->serial_ascii, sizeof(dumped_data->serial_ascii));
#  752|      memcpy(dumped_data->edidbytes, edid->bytes, 128);
#  753|      assert(sizeof(dumped_data->edidstr) == 257);

Error: CPPCHECK_WARNING (CWE-476): [#def311]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:752: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dumped_data
#  750|      memcpy(dumped_data->model,  edid->model_name, sizeof(dumped_data->model));
#  751|      memcpy(dumped_data->serial_ascii, edid->serial_ascii, sizeof(dumped_data->serial_ascii));
#  752|->    memcpy(dumped_data->edidbytes, edid->bytes, 128);
#  753|      assert(sizeof(dumped_data->edidstr) == 257);
#  754|      hexstring2(edid->bytes, 128,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def312]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:754:4: warning[-Wanalyzer-malloc-leak]: leak of 'dumped_data'
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:734:34: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:745:4: branch_false: following 'false' branch (when 'edid' is non-NULL)...
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:748:32: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:754:4: danger: 'dumped_data' leaks here; was allocated at [(1)](sarif:/runs/0/results/42/codeFlows/0/threadFlows/0/locations/0)
#  752|      memcpy(dumped_data->edidbytes, edid->bytes, 128);
#  753|      assert(sizeof(dumped_data->edidstr) == 257);
#  754|->    hexstring2(edid->bytes, 128,
#  755|                 NULL /* no separator */,
#  756|                 true /* uppercase */,

Error: CPPCHECK_WARNING (CWE-476): [#def313]
ddcutil-2.2.1/src/ddc/ddc_dumpload.c:757: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dumped_data
#  755|                 NULL /* no separator */,
#  756|                 true /* uppercase */,
#  757|->               dumped_data->edidstr, 257);
#  758|   
#  759|      // VCP values

Error: CPPCHECK_WARNING (CWE-476): [#def314]
ddcutil-2.2.1/src/ddc/ddc_output.c:640: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: formatted
#  638|               hexstring2(pvalrec->val.t.bytes, bytect, &space, false /* upper case */, hexbuf, hexbufsize);
#  639|               char * formatted = calloc(hexbufsize + 20, sizeof(char));
#  640|->             snprintf(formatted, hexbufsize+20, "VCP %02X T x%s\n", feature_code, hexbuf);
#  641|               *formatted_value_loc = formatted;
#  642|               free(hexbuf);

Error: CPPCHECK_WARNING (CWE-476): [#def315]
ddcutil-2.2.1/src/ddc/ddc_output.c:640: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: hexbuf
#  638|               hexstring2(pvalrec->val.t.bytes, bytect, &space, false /* upper case */, hexbuf, hexbufsize);
#  639|               char * formatted = calloc(hexbufsize + 20, sizeof(char));
#  640|->             snprintf(formatted, hexbufsize+20, "VCP %02X T x%s\n", feature_code, hexbuf);
#  641|               *formatted_value_loc = formatted;
#  642|               free(hexbuf);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def316]
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:606:4: warning[-Wanalyzer-malloc-leak]: leak of 'readbuf'
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:688:1: enter_function: entry to 'ddc_write_read'
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:708:21: acquire_memory: allocated here
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:713:10: call_function: calling 'ddc_i2c_write_read_raw' from 'ddc_write_read'
#  604|   {
#  605|      bool debug = false;
#  606|->    DBGTRC_STARTING(debug, TRACE_GROUP, "dh=%s, read_bytewise=%s, max_read_bytes=%d, readbuf=%p",
#  607|                                 dh_repr(dh), SBOOL(read_bytewise), max_read_bytes, readbuf );
#  608|      // DBGMSG("request_packet_ptr=%p", request_packet_ptr);

Error: GCC_ANALYZER_WARNING (CWE-127): [#def317]
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:1168:21: warning[-Wanalyzer-out-of-bounds]: stack-based buffer under-read
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:1120:1: enter_function: entry to 'ddc_write_only_with_retry'
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:1127:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:1134:20: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:1135:4: branch_true: following 'true' branch (when 'max_tries != 0')...
 branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:1137:8: branch_false: following 'false' branch...
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:1153:7: branch_false: ...to here
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:1153:7: branch_true: following 'true' branch (when 'psc < 0')...
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:1162:7: call_function: inlined call to 'sbool' from 'ddc_write_only_with_retry'
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:1162:7: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:1165:10: branch_true: following 'true' branch (when 'retryable != 0')...
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:1167:21: branch_true: ...to here
ddcutil-2.2.1/src/ddc/ddc_packet_io.c:1168:21: danger: out-of-bounds read from byte -8 till byte -1 but 'try_errors' starts at byte 0
# 1166|            psc = DDCRC_RETRIES;
# 1167|            ddc_excp = errinfo_new_with_causes(psc, try_errors, tryctr, __func__, NULL);
# 1168|->          if (psc != try_errors[tryctr-1]->status_code)
# 1169|               COUNT_STATUS_CODE(psc);     // new status code, count it
# 1170|         }

Error: CPPCHECK_WARNING (CWE-476): [#def318]
ddcutil-2.2.1/src/ddc/ddc_vcp.c:95: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: resp
#   93|   static Parsed_Nontable_Vcp_Response * create_all_zero_response(Byte feature_code) {
#   94|      Parsed_Nontable_Vcp_Response * resp = calloc(1, sizeof(Parsed_Nontable_Vcp_Response));
#   95|->    resp->vcp_code = feature_code;
#   96|      resp->valid_response = true;
#   97|      resp->supported_opcode = true;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def319]
ddcutil-2.2.1/src/ddc/ddc_vcp.c:95:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'resp'
ddcutil-2.2.1/src/ddc/ddc_vcp.c:94:42: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/ddc/ddc_vcp.c:95:4: danger: 'resp' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   93|   static Parsed_Nontable_Vcp_Response * create_all_zero_response(Byte feature_code) {
#   94|      Parsed_Nontable_Vcp_Response * resp = calloc(1, sizeof(Parsed_Nontable_Vcp_Response));
#   95|->    resp->vcp_code = feature_code;
#   96|      resp->valid_response = true;
#   97|      resp->supported_opcode = true;

Error: CPPCHECK_WARNING (CWE-476): [#def320]
ddcutil-2.2.1/src/ddc/ddc_vcp.c:96: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: resp
#   94|      Parsed_Nontable_Vcp_Response * resp = calloc(1, sizeof(Parsed_Nontable_Vcp_Response));
#   95|      resp->vcp_code = feature_code;
#   96|->    resp->valid_response = true;
#   97|      resp->supported_opcode = true;
#   98|      resp->mh = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def321]
ddcutil-2.2.1/src/ddc/ddc_vcp.c:97: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: resp
#   95|      resp->vcp_code = feature_code;
#   96|      resp->valid_response = true;
#   97|->    resp->supported_opcode = true;
#   98|      resp->mh = 0;
#   99|      resp->ml = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def322]
ddcutil-2.2.1/src/ddc/ddc_vcp.c:98: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: resp
#   96|      resp->valid_response = true;
#   97|      resp->supported_opcode = true;
#   98|->    resp->mh = 0;
#   99|      resp->ml = 0;
#  100|      resp->sh = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def323]
ddcutil-2.2.1/src/ddc/ddc_vcp.c:99: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: resp
#   97|      resp->supported_opcode = true;
#   98|      resp->mh = 0;
#   99|->    resp->ml = 0;
#  100|      resp->sh = 0;
#  101|      resp->sl = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def324]
ddcutil-2.2.1/src/ddc/ddc_vcp.c:100: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: resp
#   98|      resp->mh = 0;
#   99|      resp->ml = 0;
#  100|->    resp->sh = 0;
#  101|      resp->sl = 0;
#  102|      return resp;

Error: CPPCHECK_WARNING (CWE-476): [#def325]
ddcutil-2.2.1/src/ddc/ddc_vcp.c:101: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: resp
#   99|      resp->ml = 0;
#  100|      resp->sh = 0;
#  101|->    resp->sl = 0;
#  102|      return resp;
#  103|   }

Error: CPPCHECK_WARNING (CWE-476): [#def326]
ddcutil-2.2.1/src/dw/dw_common.c:158: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cdd
#  156|   Callback_Displays_Data * dw_new_callback_displays_data() {
#  157|      Callback_Displays_Data * cdd = calloc(1, sizeof(Callback_Displays_Data));
#  158|->    cdd->main_process_id = PID();
#  159|      return cdd;
#  160|   }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def327]
ddcutil-2.2.1/src/dw/dw_common.c:158:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cdd'
ddcutil-2.2.1/src/dw/dw_common.c:157:35: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/dw/dw_common.c:158:4: danger: 'cdd' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  156|   Callback_Displays_Data * dw_new_callback_displays_data() {
#  157|      Callback_Displays_Data * cdd = calloc(1, sizeof(Callback_Displays_Data));
#  158|->    cdd->main_process_id = PID();
#  159|      return cdd;
#  160|   }

Error: CPPCHECK_WARNING (CWE-476): [#def328]
ddcutil-2.2.1/src/dw/dw_main.c:217: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rdd
#  215|         // Start recheck thread
#  216|         Recheck_Displays_Data * rdd = calloc(1, sizeof(Recheck_Displays_Data));
#  217|->       memcpy(rdd->marker, RECHECK_DISPLAYS_DATA_MARKER,4);
#  218|         recheck_thread = g_thread_new("display_recheck_thread",             // optional thread name
#  219|                                       dw_recheck_displays_func,

Error: CPPCHECK_WARNING (CWE-476): [#def329]
ddcutil-2.2.1/src/dw/dw_main.c:226: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: wdd
#  224|         // Start watch thread
#  225|         Watch_Displays_Data * wdd = calloc(1, sizeof(Watch_Displays_Data));
#  226|->       memcpy(wdd->marker, WATCH_DISPLAYS_DATA_MARKER, 4);
#  227|         wdd->main_process_id = pid();
#  228|         wdd->main_thread_id = tid();    // alt = syscall(SYS_gettid);

Error: CPPCHECK_WARNING (CWE-476): [#def330]
ddcutil-2.2.1/src/dw/dw_main.c:227: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: wdd
#  225|         Watch_Displays_Data * wdd = calloc(1, sizeof(Watch_Displays_Data));
#  226|         memcpy(wdd->marker, WATCH_DISPLAYS_DATA_MARKER, 4);
#  227|->       wdd->main_process_id = pid();
#  228|         wdd->main_thread_id = tid();    // alt = syscall(SYS_gettid);
#  229|         // event_classes &= ~DDCA_EVENT_CLASS_DPMS;     // *** TEMP ***

Error: CPPCHECK_WARNING (CWE-476): [#def331]
ddcutil-2.2.1/src/dw/dw_main.c:228: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: wdd
#  226|         memcpy(wdd->marker, WATCH_DISPLAYS_DATA_MARKER, 4);
#  227|         wdd->main_process_id = pid();
#  228|->       wdd->main_thread_id = tid();    // alt = syscall(SYS_gettid);
#  229|         // event_classes &= ~DDCA_EVENT_CLASS_DPMS;     // *** TEMP ***
#  230|         wdd->event_classes = event_classes;

Error: CPPCHECK_WARNING (CWE-476): [#def332]
ddcutil-2.2.1/src/dw/dw_main.c:230: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: wdd
#  228|         wdd->main_thread_id = tid();    // alt = syscall(SYS_gettid);
#  229|         // event_classes &= ~DDCA_EVENT_CLASS_DPMS;     // *** TEMP ***
#  230|->       wdd->event_classes = event_classes;
#  231|         wdd->watch_mode = resolved_watch_mode;
#  232|         wdd->watch_loop_millisec = calculated_watch_loop_millisec;

Error: CPPCHECK_WARNING (CWE-476): [#def333]
ddcutil-2.2.1/src/dw/dw_main.c:231: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: wdd
#  229|         // event_classes &= ~DDCA_EVENT_CLASS_DPMS;     // *** TEMP ***
#  230|         wdd->event_classes = event_classes;
#  231|->       wdd->watch_mode = resolved_watch_mode;
#  232|         wdd->watch_loop_millisec = calculated_watch_loop_millisec;
#  233|   #ifdef USE_X11

Error: CPPCHECK_WARNING (CWE-476): [#def334]
ddcutil-2.2.1/src/dw/dw_main.c:232: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: wdd
#  230|         wdd->event_classes = event_classes;
#  231|         wdd->watch_mode = resolved_watch_mode;
#  232|->       wdd->watch_loop_millisec = calculated_watch_loop_millisec;
#  233|   #ifdef USE_X11
#  234|         if (xev_data)

Error: CPPCHECK_WARNING (CWE-476): [#def335]
ddcutil-2.2.1/src/dw/dw_recheck.c:86: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: entry
#   84|   
#   85|      Recheck_Queue_Entry * entry = calloc(1, sizeof(Recheck_Queue_Entry));
#   86|->    entry->dref = dref;
#   87|      entry->initial_ts_nanos = cur_realtime_nanosec();
#   88|      entry->sleepctr = 0;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def336]
ddcutil-2.2.1/src/dw/dw_recheck.c:86:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'entry'
ddcutil-2.2.1/src/dw/dw_recheck.c:85:34: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/dw/dw_recheck.c:86:4: danger: 'entry' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   84|   
#   85|      Recheck_Queue_Entry * entry = calloc(1, sizeof(Recheck_Queue_Entry));
#   86|->    entry->dref = dref;
#   87|      entry->initial_ts_nanos = cur_realtime_nanosec();
#   88|      entry->sleepctr = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def337]
ddcutil-2.2.1/src/dw/dw_recheck.c:87: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: entry
#   85|      Recheck_Queue_Entry * entry = calloc(1, sizeof(Recheck_Queue_Entry));
#   86|      entry->dref = dref;
#   87|->    entry->initial_ts_nanos = cur_realtime_nanosec();
#   88|      entry->sleepctr = 0;
#   89|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def338]
ddcutil-2.2.1/src/dw/dw_recheck.c:87:30: warning[-Wanalyzer-malloc-leak]: leak of 'entry'
ddcutil-2.2.1/src/dw/dw_recheck.c:85:34: acquire_memory: allocated here
ddcutil-2.2.1/src/dw/dw_recheck.c:87:30: danger: 'entry' leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#   85|      Recheck_Queue_Entry * entry = calloc(1, sizeof(Recheck_Queue_Entry));
#   86|      entry->dref = dref;
#   87|->    entry->initial_ts_nanos = cur_realtime_nanosec();
#   88|      entry->sleepctr = 0;
#   89|   

Error: CPPCHECK_WARNING (CWE-476): [#def339]
ddcutil-2.2.1/src/dw/dw_recheck.c:88: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: entry
#   86|      entry->dref = dref;
#   87|      entry->initial_ts_nanos = cur_realtime_nanosec();
#   88|->    entry->sleepctr = 0;
#   89|   
#   90|      // g_mutex_lock(recheck_queue_mutex);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def340]
ddcutil-2.2.1/src/dw/dw_recheck.c:91:4: warning[-Wanalyzer-malloc-leak]: leak of 'entry'
ddcutil-2.2.1/src/dw/dw_recheck.c:85:34: acquire_memory: allocated here
ddcutil-2.2.1/src/dw/dw_recheck.c:91:4: danger: 'entry' leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#   89|   
#   90|      // g_mutex_lock(recheck_queue_mutex);
#   91|->    g_async_queue_push(recheck_queue, entry);
#   92|      // g_mutex_unlock(recheck_queue_mutex);
#   93|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def341]
ddcutil-2.2.1/src/dw/dw_recheck.c:172:28: warning[-Wanalyzer-null-dereference]: dereference of NULL 'rqe'
ddcutil-2.2.1/src/dw/dw_recheck.c:151:11: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_recheck.c:152:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_recheck.c:156:14: branch_true: following 'true' branch (when 'rqe' is NULL)...
ddcutil-2.2.1/src/dw/dw_recheck.c:156:22: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_recheck.c:167:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_recheck.c:172:28: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_recheck.c:172:28: danger: dereference of NULL 'rqe'
#  170|         }
#  171|   
#  172|->       if (cur_time_nanos > rqe->initial_ts_nanos + MILLIS2NANOS(max_sleep_time_millis)) {
#  173|            emit_recheck_debug_msg(debug, DDCA_SYSLOG_NOTICE,
#  174|                  "ddc did not become enabled for %s after %d milliseconds",

Error: CPPCHECK_WARNING (CWE-476): [#def342]
ddcutil-2.2.1/src/dw/dw_status_events.c:396: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cqe
#  394|            DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "Calling g_thread_new()...");
#  395|            Callback_Queue_Entry * cqe = calloc(1, sizeof (Callback_Queue_Entry));
#  396|->          cqe->event = evt;
#  397|            cqe->func =  g_ptr_array_index(display_detection_callbacks, ndx);
#  398|            // traced_function_stack_suspended = true;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def343]
ddcutil-2.2.1/src/dw/dw_status_events.c:396:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cqe'
ddcutil-2.2.1/src/dw/dw_status_events.c:389:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_status_events.c:389:54: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_status_events.c:390:7: branch_true: following 'true' branch (when 'callback_ct > 0')...
ddcutil-2.2.1/src/dw/dw_status_events.c:391:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_status_events.c:393:25: branch_true: following 'true' branch (when 'ndx < callback_ct')...
ddcutil-2.2.1/src/dw/dw_status_events.c:394:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_status_events.c:395:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/dw/dw_status_events.c:396:10: danger: 'cqe' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#  394|            DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "Calling g_thread_new()...");
#  395|            Callback_Queue_Entry * cqe = calloc(1, sizeof (Callback_Queue_Entry));
#  396|->          cqe->event = evt;
#  397|            cqe->func =  g_ptr_array_index(display_detection_callbacks, ndx);
#  398|            // traced_function_stack_suspended = true;

Error: CPPCHECK_WARNING (CWE-476): [#def344]
ddcutil-2.2.1/src/dw/dw_status_events.c:397: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cqe
#  395|            Callback_Queue_Entry * cqe = calloc(1, sizeof (Callback_Queue_Entry));
#  396|            cqe->event = evt;
#  397|->          cqe->func =  g_ptr_array_index(display_detection_callbacks, ndx);
#  398|            // traced_function_stack_suspended = true;
#  399|            GThread * callback_thread = g_thread_new(

Error: GCC_ANALYZER_WARNING (CWE-401): [#def345]
ddcutil-2.2.1/src/dw/dw_status_events.c:399:38: warning[-Wanalyzer-malloc-leak]: leak of 'cqe'
ddcutil-2.2.1/src/dw/dw_status_events.c:389:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_status_events.c:389:54: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_status_events.c:390:7: branch_true: following 'true' branch (when 'callback_ct > 0')...
ddcutil-2.2.1/src/dw/dw_status_events.c:391:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_status_events.c:393:25: branch_true: following 'true' branch (when 'ndx < callback_ct')...
ddcutil-2.2.1/src/dw/dw_status_events.c:394:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_status_events.c:395:39: acquire_memory: allocated here
ddcutil-2.2.1/src/dw/dw_status_events.c:399:38: danger: 'cqe' leaks here; was allocated at [(7)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/6)
#  397|            cqe->func =  g_ptr_array_index(display_detection_callbacks, ndx);
#  398|            // traced_function_stack_suspended = true;
#  399|->          GThread * callback_thread = g_thread_new(
#  400|                                          "single_callback_worker",  // optional thread name
#  401|                                          dw_execute_callback_func,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def346]
ddcutil-2.2.1/src/dw/dw_udev.c:133:4: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:680:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:682:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:684:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:685:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:686:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:687:24: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:695:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:696:19: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:697:41: call_function: calling 'dw_i2c_check_bus_changes_for_connector' from 'dw_watch_displays_udev'
#  131|      bool debug = false;
#  132|      // int debug_depth = (debug) ? 1 : -1;
#  133|->    DBGTRC_STARTING(debug, TRACE_GROUP, "drm_connector_name=%s, prior_has_edid =%s",
#  134|            drm_connector_name, SBOOL(prior_has_edid));
#  135|      assert(drm_connector_name);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def347]
ddcutil-2.2.1/src/dw/dw_udev.c:227:4: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:744:35: call_function: calling 'dw_i2c_check_bus_changes' from 'dw_watch_displays_udev'
#  225|   {
#  226|      bool debug = false;
#  227|->    DBGTRC_STARTING(debug, TRACE_GROUP, "bs_prev_buses_w_edid: %s", BS256_REPR(bs_prev_buses_w_edid));
#  228|   
#  229|   #ifdef OLD

Error: GCC_ANALYZER_WARNING (CWE-401): [#def348]
ddcutil-2.2.1/src/dw/dw_udev.c:233:38: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:744:35: call_function: calling 'dw_i2c_check_bus_changes' from 'dw_watch_displays_udev'
#  231|      Bit_Set_256 bs_new_buses_w_edid =  buses_bitset_from_businfo_array(new_buses, /* only_connected */ true);
#  232|   #endif
#  233|->    Bit_Set_256 bs_new_buses_w_edid = i2c_buses_w_edid_as_bitset();
#  234|   
#  235|      DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "bs_new_buses_w_edid: %s", BS256_REPR(bs_new_buses_w_edid));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def349]
ddcutil-2.2.1/src/dw/dw_udev.c:235:4: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:744:35: call_function: calling 'dw_i2c_check_bus_changes' from 'dw_watch_displays_udev'
#  233|      Bit_Set_256 bs_new_buses_w_edid = i2c_buses_w_edid_as_bitset();
#  234|   
#  235|->    DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "bs_new_buses_w_edid: %s", BS256_REPR(bs_new_buses_w_edid));
#  236|   
#  237|      if (!bs256_eq(bs_prev_buses_w_edid, bs_new_buses_w_edid)) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def350]
ddcutil-2.2.1/src/dw/dw_udev.c:237:9: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:744:35: call_function: calling 'dw_i2c_check_bus_changes' from 'dw_watch_displays_udev'
#  235|      DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "bs_new_buses_w_edid: %s", BS256_REPR(bs_new_buses_w_edid));
#  236|   
#  237|->    if (!bs256_eq(bs_prev_buses_w_edid, bs_new_buses_w_edid)) {
#  238|         // Detect need for special handling for case of display disconnected.
#  239|         Bit_Set_256 bs_removed = bs256_and_not(bs_prev_buses_w_edid,bs_new_buses_w_edid);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def351]
ddcutil-2.2.1/src/dw/dw_udev.c:309:4: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:680:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:682:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:684:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:685:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:686:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:687:24: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:695:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:696:19: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:697:41: call_function: calling 'dw_i2c_check_bus_changes_for_connector' from 'dw_watch_displays_udev'
#  307|      bool debug = false;
#  308|      // int debug_depth = (debug) ? 1 : -1;
#  309|->    DBGTRC_STARTING(debug, TRACE_GROUP, "connector_number=%d, connector_name=%s, bs_prev_buses_w_edid: %s",
#  310|            connector_number, connector_name, BS256_REPR(bs_prev_buses_w_edid));
#  311|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def352]
ddcutil-2.2.1/src/dw/dw_udev.c:313:16: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:680:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:682:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:684:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:685:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:686:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:687:24: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:695:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:696:19: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:697:41: call_function: calling 'dw_i2c_check_bus_changes_for_connector' from 'dw_watch_displays_udev'
#  311|   
#  312|      Bit_Set_256 bs_new_buses_w_edid = bs_prev_buses_w_edid;
#  313|->    int busno = search_all_businfo_records_by_connector_name(connector_name);
#  314|      // busno -1 possible for added hub devices, only the one w attached monitor will have busno
#  315|      if (busno < 0)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def353]
ddcutil-2.2.1/src/dw/dw_udev.c:318:26: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:680:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:682:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:684:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:685:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:686:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:687:24: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:695:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:696:19: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:697:41: call_function: calling 'dw_i2c_check_bus_changes_for_connector' from 'dw_watch_displays_udev'
#  316|         goto bye;
#  317|   
#  318|->    bool prior_has_edid = bs256_contains(bs_prev_buses_w_edid, busno);
#  319|      bool stabilized_bus_has_edid =
#  320|           // ddc_i2c_stabilized_bus_by_connector_id(connector_number, prior_has_edid);

Error: CPPCHECK_WARNING (CWE-476): [#def354]
ddcutil-2.2.1/src/dw/dw_udev.c:396: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cd
#  394|   Udev_Event_Detail* collect_udev_event_detail(struct udev_device * dev) {
#  395|      Udev_Event_Detail * cd = calloc(1, sizeof(Udev_Event_Detail));
#  396|->    cd->prop_subsystem = udev_device_get_property_value(dev, "SUBSYSTEM");
#  397|      cd->prop_action    = udev_device_get_property_value(dev, "ACTION");     // always "changed"
#  398|      cd->prop_connector = udev_device_get_property_value(dev, "CONNECTOR");  // drm connector number

Error: GCC_ANALYZER_WARNING (CWE-476): [#def355]
ddcutil-2.2.1/src/dw/dw_udev.c:396:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cd'
ddcutil-2.2.1/src/dw/dw_udev.c:395:29: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/dw/dw_udev.c:396:4: danger: 'cd' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/16/codeFlows/0/threadFlows/0/locations/0)
#  394|   Udev_Event_Detail* collect_udev_event_detail(struct udev_device * dev) {
#  395|      Udev_Event_Detail * cd = calloc(1, sizeof(Udev_Event_Detail));
#  396|->    cd->prop_subsystem = udev_device_get_property_value(dev, "SUBSYSTEM");
#  397|      cd->prop_action    = udev_device_get_property_value(dev, "ACTION");     // always "changed"
#  398|      cd->prop_connector = udev_device_get_property_value(dev, "CONNECTOR");  // drm connector number

Error: GCC_ANALYZER_WARNING (CWE-401): [#def356]
ddcutil-2.2.1/src/dw/dw_udev.c:396:25: warning[-Wanalyzer-malloc-leak]: leak of 'cd'
ddcutil-2.2.1/src/dw/dw_udev.c:395:29: acquire_memory: allocated here
ddcutil-2.2.1/src/dw/dw_udev.c:396:25: danger: 'cd' leaks here; was allocated at [(1)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/0)
#  394|   Udev_Event_Detail* collect_udev_event_detail(struct udev_device * dev) {
#  395|      Udev_Event_Detail * cd = calloc(1, sizeof(Udev_Event_Detail));
#  396|->    cd->prop_subsystem = udev_device_get_property_value(dev, "SUBSYSTEM");
#  397|      cd->prop_action    = udev_device_get_property_value(dev, "ACTION");     // always "changed"
#  398|      cd->prop_connector = udev_device_get_property_value(dev, "CONNECTOR");  // drm connector number

Error: CPPCHECK_WARNING (CWE-476): [#def357]
ddcutil-2.2.1/src/dw/dw_udev.c:397: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cd
#  395|      Udev_Event_Detail * cd = calloc(1, sizeof(Udev_Event_Detail));
#  396|      cd->prop_subsystem = udev_device_get_property_value(dev, "SUBSYSTEM");
#  397|->    cd->prop_action    = udev_device_get_property_value(dev, "ACTION");     // always "changed"
#  398|      cd->prop_connector = udev_device_get_property_value(dev, "CONNECTOR");  // drm connector number
#  399|      cd->prop_devname   = udev_device_get_property_value(dev, "DEVNAME");    // e.g. /dev/dri/card0

Error: GCC_ANALYZER_WARNING (CWE-401): [#def358]
ddcutil-2.2.1/src/dw/dw_udev.c:397:25: warning[-Wanalyzer-malloc-leak]: leak of 'cd'
ddcutil-2.2.1/src/dw/dw_udev.c:395:29: acquire_memory: allocated here
ddcutil-2.2.1/src/dw/dw_udev.c:397:25: danger: 'cd' leaks here; was allocated at [(1)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/0)
#  395|      Udev_Event_Detail * cd = calloc(1, sizeof(Udev_Event_Detail));
#  396|      cd->prop_subsystem = udev_device_get_property_value(dev, "SUBSYSTEM");
#  397|->    cd->prop_action    = udev_device_get_property_value(dev, "ACTION");     // always "changed"
#  398|      cd->prop_connector = udev_device_get_property_value(dev, "CONNECTOR");  // drm connector number
#  399|      cd->prop_devname   = udev_device_get_property_value(dev, "DEVNAME");    // e.g. /dev/dri/card0

Error: CPPCHECK_WARNING (CWE-476): [#def359]
ddcutil-2.2.1/src/dw/dw_udev.c:398: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cd
#  396|      cd->prop_subsystem = udev_device_get_property_value(dev, "SUBSYSTEM");
#  397|      cd->prop_action    = udev_device_get_property_value(dev, "ACTION");     // always "changed"
#  398|->    cd->prop_connector = udev_device_get_property_value(dev, "CONNECTOR");  // drm connector number
#  399|      cd->prop_devname   = udev_device_get_property_value(dev, "DEVNAME");    // e.g. /dev/dri/card0
#  400|      cd->prop_hotplug   = udev_device_get_property_value(dev, "HOTPLUG");    // always 1

Error: GCC_ANALYZER_WARNING (CWE-401): [#def360]
ddcutil-2.2.1/src/dw/dw_udev.c:398:25: warning[-Wanalyzer-malloc-leak]: leak of 'cd'
ddcutil-2.2.1/src/dw/dw_udev.c:395:29: acquire_memory: allocated here
ddcutil-2.2.1/src/dw/dw_udev.c:398:25: danger: 'cd' leaks here; was allocated at [(1)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/0)
#  396|      cd->prop_subsystem = udev_device_get_property_value(dev, "SUBSYSTEM");
#  397|      cd->prop_action    = udev_device_get_property_value(dev, "ACTION");     // always "changed"
#  398|->    cd->prop_connector = udev_device_get_property_value(dev, "CONNECTOR");  // drm connector number
#  399|      cd->prop_devname   = udev_device_get_property_value(dev, "DEVNAME");    // e.g. /dev/dri/card0
#  400|      cd->prop_hotplug   = udev_device_get_property_value(dev, "HOTPLUG");    // always 1

Error: CPPCHECK_WARNING (CWE-476): [#def361]
ddcutil-2.2.1/src/dw/dw_udev.c:399: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cd
#  397|      cd->prop_action    = udev_device_get_property_value(dev, "ACTION");     // always "changed"
#  398|      cd->prop_connector = udev_device_get_property_value(dev, "CONNECTOR");  // drm connector number
#  399|->    cd->prop_devname   = udev_device_get_property_value(dev, "DEVNAME");    // e.g. /dev/dri/card0
#  400|      cd->prop_hotplug   = udev_device_get_property_value(dev, "HOTPLUG");    // always 1
#  401|      cd->sysname        = udev_device_get_sysname(dev);                      // e.g. card0, i2c-27

Error: GCC_ANALYZER_WARNING (CWE-401): [#def362]
ddcutil-2.2.1/src/dw/dw_udev.c:399:25: warning[-Wanalyzer-malloc-leak]: leak of 'cd'
ddcutil-2.2.1/src/dw/dw_udev.c:395:29: acquire_memory: allocated here
ddcutil-2.2.1/src/dw/dw_udev.c:399:25: danger: 'cd' leaks here; was allocated at [(1)](sarif:/runs/0/results/20/codeFlows/0/threadFlows/0/locations/0)
#  397|      cd->prop_action    = udev_device_get_property_value(dev, "ACTION");     // always "changed"
#  398|      cd->prop_connector = udev_device_get_property_value(dev, "CONNECTOR");  // drm connector number
#  399|->    cd->prop_devname   = udev_device_get_property_value(dev, "DEVNAME");    // e.g. /dev/dri/card0
#  400|      cd->prop_hotplug   = udev_device_get_property_value(dev, "HOTPLUG");    // always 1
#  401|      cd->sysname        = udev_device_get_sysname(dev);                      // e.g. card0, i2c-27

Error: CPPCHECK_WARNING (CWE-476): [#def363]
ddcutil-2.2.1/src/dw/dw_udev.c:400: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cd
#  398|      cd->prop_connector = udev_device_get_property_value(dev, "CONNECTOR");  // drm connector number
#  399|      cd->prop_devname   = udev_device_get_property_value(dev, "DEVNAME");    // e.g. /dev/dri/card0
#  400|->    cd->prop_hotplug   = udev_device_get_property_value(dev, "HOTPLUG");    // always 1
#  401|      cd->sysname        = udev_device_get_sysname(dev);                      // e.g. card0, i2c-27
#  402|      cd-> attr_name     = udev_device_get_sysattr_value(dev, "name");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def364]
ddcutil-2.2.1/src/dw/dw_udev.c:400:25: warning[-Wanalyzer-malloc-leak]: leak of 'cd'
ddcutil-2.2.1/src/dw/dw_udev.c:395:29: acquire_memory: allocated here
ddcutil-2.2.1/src/dw/dw_udev.c:400:25: danger: 'cd' leaks here; was allocated at [(1)](sarif:/runs/0/results/21/codeFlows/0/threadFlows/0/locations/0)
#  398|      cd->prop_connector = udev_device_get_property_value(dev, "CONNECTOR");  // drm connector number
#  399|      cd->prop_devname   = udev_device_get_property_value(dev, "DEVNAME");    // e.g. /dev/dri/card0
#  400|->    cd->prop_hotplug   = udev_device_get_property_value(dev, "HOTPLUG");    // always 1
#  401|      cd->sysname        = udev_device_get_sysname(dev);                      // e.g. card0, i2c-27
#  402|      cd-> attr_name     = udev_device_get_sysattr_value(dev, "name");

Error: CPPCHECK_WARNING (CWE-476): [#def365]
ddcutil-2.2.1/src/dw/dw_udev.c:401: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cd
#  399|      cd->prop_devname   = udev_device_get_property_value(dev, "DEVNAME");    // e.g. /dev/dri/card0
#  400|      cd->prop_hotplug   = udev_device_get_property_value(dev, "HOTPLUG");    // always 1
#  401|->    cd->sysname        = udev_device_get_sysname(dev);                      // e.g. card0, i2c-27
#  402|      cd-> attr_name     = udev_device_get_sysattr_value(dev, "name");
#  403|      return cd;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def366]
ddcutil-2.2.1/src/dw/dw_udev.c:401:25: warning[-Wanalyzer-malloc-leak]: leak of 'cd'
ddcutil-2.2.1/src/dw/dw_udev.c:395:29: acquire_memory: allocated here
ddcutil-2.2.1/src/dw/dw_udev.c:401:25: danger: 'cd' leaks here; was allocated at [(1)](sarif:/runs/0/results/22/codeFlows/0/threadFlows/0/locations/0)
#  399|      cd->prop_devname   = udev_device_get_property_value(dev, "DEVNAME");    // e.g. /dev/dri/card0
#  400|      cd->prop_hotplug   = udev_device_get_property_value(dev, "HOTPLUG");    // always 1
#  401|->    cd->sysname        = udev_device_get_sysname(dev);                      // e.g. card0, i2c-27
#  402|      cd-> attr_name     = udev_device_get_sysattr_value(dev, "name");
#  403|      return cd;

Error: CPPCHECK_WARNING (CWE-476): [#def367]
ddcutil-2.2.1/src/dw/dw_udev.c:402: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cd
#  400|      cd->prop_hotplug   = udev_device_get_property_value(dev, "HOTPLUG");    // always 1
#  401|      cd->sysname        = udev_device_get_sysname(dev);                      // e.g. card0, i2c-27
#  402|->    cd-> attr_name     = udev_device_get_sysattr_value(dev, "name");
#  403|      return cd;
#  404|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def368]
ddcutil-2.2.1/src/dw/dw_udev.c:402:25: warning[-Wanalyzer-malloc-leak]: leak of 'cd'
ddcutil-2.2.1/src/dw/dw_udev.c:395:29: acquire_memory: allocated here
ddcutil-2.2.1/src/dw/dw_udev.c:402:25: danger: 'cd' leaks here; was allocated at [(1)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/0)
#  400|      cd->prop_hotplug   = udev_device_get_property_value(dev, "HOTPLUG");    // always 1
#  401|      cd->sysname        = udev_device_get_sysname(dev);                      // e.g. card0, i2c-27
#  402|->    cd-> attr_name     = udev_device_get_sysattr_value(dev, "name");
#  403|      return cd;
#  404|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def369]
ddcutil-2.2.1/src/dw/dw_udev.c:414:4: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:610:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:610:10: call_function: calling 'dbgrpt_udev_event_detail' from 'dw_watch_displays_udev'
#  412|   void dbgrpt_udev_event_detail(Udev_Event_Detail * detail, int depth) {
#  413|      assert(detail);
#  414|->    rpt_structure_loc("Udev_Event_Detail", detail, depth);
#  415|      int d1 = depth + 1;
#  416|      rpt_vstring(d1, "prop_subsystem:  %s", detail->prop_subsystem);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def370]
ddcutil-2.2.1/src/dw/dw_udev.c:416:4: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:610:10: call_function: calling 'dbgrpt_udev_event_detail' from 'dw_watch_displays_udev'
#  414|      rpt_structure_loc("Udev_Event_Detail", detail, depth);
#  415|      int d1 = depth + 1;
#  416|->    rpt_vstring(d1, "prop_subsystem:  %s", detail->prop_subsystem);
#  417|      rpt_vstring(d1, "prop_action:     %s", detail->prop_action);
#  418|      rpt_vstring(d1, "prop_connector:  %s", detail->prop_connector);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def371]
ddcutil-2.2.1/src/dw/dw_udev.c:417:4: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:610:10: call_function: calling 'dbgrpt_udev_event_detail' from 'dw_watch_displays_udev'
#  415|      int d1 = depth + 1;
#  416|      rpt_vstring(d1, "prop_subsystem:  %s", detail->prop_subsystem);
#  417|->    rpt_vstring(d1, "prop_action:     %s", detail->prop_action);
#  418|      rpt_vstring(d1, "prop_connector:  %s", detail->prop_connector);
#  419|      rpt_vstring(d1, "prop_devname:    %s", detail->prop_devname);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def372]
ddcutil-2.2.1/src/dw/dw_udev.c:418:4: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:610:10: call_function: calling 'dbgrpt_udev_event_detail' from 'dw_watch_displays_udev'
#  416|      rpt_vstring(d1, "prop_subsystem:  %s", detail->prop_subsystem);
#  417|      rpt_vstring(d1, "prop_action:     %s", detail->prop_action);
#  418|->    rpt_vstring(d1, "prop_connector:  %s", detail->prop_connector);
#  419|      rpt_vstring(d1, "prop_devname:    %s", detail->prop_devname);
#  420|      rpt_vstring(d1, "prop_hotplug:    %s", detail->prop_hotplug);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def373]
ddcutil-2.2.1/src/dw/dw_udev.c:419:4: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:610:10: call_function: calling 'dbgrpt_udev_event_detail' from 'dw_watch_displays_udev'
#  417|      rpt_vstring(d1, "prop_action:     %s", detail->prop_action);
#  418|      rpt_vstring(d1, "prop_connector:  %s", detail->prop_connector);
#  419|->    rpt_vstring(d1, "prop_devname:    %s", detail->prop_devname);
#  420|      rpt_vstring(d1, "prop_hotplug:    %s", detail->prop_hotplug);
#  421|      rpt_vstring(d1, "sysname:         %s", detail->sysname);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def374]
ddcutil-2.2.1/src/dw/dw_udev.c:420:4: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:610:10: call_function: calling 'dbgrpt_udev_event_detail' from 'dw_watch_displays_udev'
#  418|      rpt_vstring(d1, "prop_connector:  %s", detail->prop_connector);
#  419|      rpt_vstring(d1, "prop_devname:    %s", detail->prop_devname);
#  420|->    rpt_vstring(d1, "prop_hotplug:    %s", detail->prop_hotplug);
#  421|      rpt_vstring(d1, "sysname:         %s", detail->sysname);
#  422|      rpt_vstring(d1, "attr_name:       %s", detail->attr_name);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def375]
ddcutil-2.2.1/src/dw/dw_udev.c:421:4: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:610:10: call_function: calling 'dbgrpt_udev_event_detail' from 'dw_watch_displays_udev'
#  419|      rpt_vstring(d1, "prop_devname:    %s", detail->prop_devname);
#  420|      rpt_vstring(d1, "prop_hotplug:    %s", detail->prop_hotplug);
#  421|->    rpt_vstring(d1, "sysname:         %s", detail->sysname);
#  422|      rpt_vstring(d1, "attr_name:       %s", detail->attr_name);
#  423|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def376]
ddcutil-2.2.1/src/dw/dw_udev.c:422:4: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:610:10: call_function: calling 'dbgrpt_udev_event_detail' from 'dw_watch_displays_udev'
#  420|      rpt_vstring(d1, "prop_hotplug:    %s", detail->prop_hotplug);
#  421|      rpt_vstring(d1, "sysname:         %s", detail->sysname);
#  422|->    rpt_vstring(d1, "attr_name:       %s", detail->attr_name);
#  423|   }
#  424|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def377]
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:680:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:682:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:684:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:685:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/32/codeFlows/0/threadFlows/0/locations/13)
#  607|         Udev_Event_Detail * cd = collect_udev_event_detail(dev);
#  608|         assert(cd);      // mollify coverity scan
#  609|->        if (IS_DBGTRC(debug || report_udev_events, DDCA_TRC_NONE))
#  610|            dbgrpt_udev_event_detail(cd, 2);
#  611|          // xxx("Event received");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def378]
ddcutil-2.2.1/src/dw/dw_udev.c:613:12: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:613:12: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/34/codeFlows/0/threadFlows/0/locations/13)
#  611|          // xxx("Event received");
#  612|   
#  613|->       if (!streq(cd->prop_subsystem, "i2c-dev") &&  !streq(cd->prop_subsystem, "drm")) {
#  614|            DBGMSG("Unexpected subsystem: %s", cd->prop_subsystem);
#  615|         }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def379]
ddcutil-2.2.1/src/dw/dw_udev.c:613:54: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:613:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:613:54: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:613:54: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/35/codeFlows/0/threadFlows/0/locations/13)
#  611|          // xxx("Event received");
#  612|   
#  613|->       if (!streq(cd->prop_subsystem, "i2c-dev") &&  !streq(cd->prop_subsystem, "drm")) {
#  614|            DBGMSG("Unexpected subsystem: %s", cd->prop_subsystem);
#  615|         }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def380]
ddcutil-2.2.1/src/dw/dw_udev.c:614:10: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:613:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:614:10: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/36/codeFlows/0/threadFlows/0/locations/13)
#  612|   
#  613|         if (!streq(cd->prop_subsystem, "i2c-dev") &&  !streq(cd->prop_subsystem, "drm")) {
#  614|->          DBGMSG("Unexpected subsystem: %s", cd->prop_subsystem);
#  615|         }
#  616|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def381]
ddcutil-2.2.1/src/dw/dw_udev.c:617:18: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:617:18: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/37/codeFlows/0/threadFlows/0/locations/13)
#  615|         }
#  616|   
#  617|->       else if (  streq(cd->prop_subsystem, "i2c-dev") && streq(cd->prop_action, "add") ) {
#  618|            // const char * sysname = cd->sysname;     // e.g i2c-27
#  619|            // const char * attr_name = cd->attr_name;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def382]
ddcutil-2.2.1/src/dw/dw_udev.c:617:58: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:617:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:617:58: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:617:58: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/38/codeFlows/0/threadFlows/0/locations/13)
#  615|         }
#  616|   
#  617|->       else if (  streq(cd->prop_subsystem, "i2c-dev") && streq(cd->prop_action, "add") ) {
#  618|            // const char * sysname = cd->sysname;     // e.g i2c-27
#  619|            // const char * attr_name = cd->attr_name;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def383]
ddcutil-2.2.1/src/dw/dw_udev.c:620:22: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:617:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:620:22: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/39/codeFlows/0/threadFlows/0/locations/13)
#  618|            // const char * sysname = cd->sysname;     // e.g i2c-27
#  619|            // const char * attr_name = cd->attr_name;
#  620|->          int busno = i2c_name_to_busno(cd->sysname);
#  621|            if (busno < 0) {
#  622|               MSG_W_SYSLOG(DDCA_SYSLOG_ERROR, "sysname is not i2c-n");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def384]
ddcutil-2.2.1/src/dw/dw_udev.c:622:13: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:617:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:621:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:622:13: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:622:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:622:13: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:622:13: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/40/codeFlows/0/threadFlows/0/locations/13)
#  620|            int busno = i2c_name_to_busno(cd->sysname);
#  621|            if (busno < 0) {
#  622|->             MSG_W_SYSLOG(DDCA_SYSLOG_ERROR, "sysname is not i2c-n");
#  623|            }
#  624|            else {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def385]
ddcutil-2.2.1/src/dw/dw_udev.c:625:39: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:617:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:621:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:625:39: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:625:39: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/45/codeFlows/0/threadFlows/0/locations/13)
#  623|            }
#  624|            else {
#  625|->             I2C_Bus_Info * businfo =  i2c_find_bus_info_in_gptrarray_by_busno(all_i2c_buses, busno);
#  626|               if (businfo) {
#  627|                  DBGMSG("Unexpected businfo record %p already exists for bus %d", businfo, busno);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def386]
ddcutil-2.2.1/src/dw/dw_udev.c:627:16: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:617:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:621:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:625:39: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:626:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:627:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:627:16: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/46/codeFlows/0/threadFlows/0/locations/13)
#  625|               I2C_Bus_Info * businfo =  i2c_find_bus_info_in_gptrarray_by_busno(all_i2c_buses, busno);
#  626|               if (businfo) {
#  627|->                DBGMSG("Unexpected businfo record %p already exists for bus %d", businfo, busno);
#  628|                  // TO DO: check for use in non-removed drefs
#  629|                  i2c_reset_bus_info(businfo);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def387]
ddcutil-2.2.1/src/dw/dw_udev.c:629:16: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:617:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:621:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:625:39: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:626:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:627:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:629:16: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/47/codeFlows/0/threadFlows/0/locations/13)
#  627|                  DBGMSG("Unexpected businfo record %p already exists for bus %d", businfo, busno);
#  628|                  // TO DO: check for use in non-removed drefs
#  629|->                i2c_reset_bus_info(businfo);
#  630|               }
#  631|               else {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def388]
ddcutil-2.2.1/src/dw/dw_udev.c:632:26: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:617:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:621:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:625:39: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:626:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:632:26: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:632:26: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/48/codeFlows/0/threadFlows/0/locations/13)
#  630|               }
#  631|               else {
#  632|->                businfo = i2c_get_and_check_bus_info(busno);
#  633|               }
#  634|               // Error_Info * err = i2c_check_bus2(businfo);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def389]
ddcutil-2.2.1/src/dw/dw_udev.c:636:13: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:617:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:621:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:625:39: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:636:13: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/49/codeFlows/0/threadFlows/0/locations/13)
#  634|               // Error_Info * err = i2c_check_bus2(businfo);
#  635|               // ERRINFO_FREE_WITH_REPORT(err, debug || IS_TRACING() || report_freed_exceptions);
#  636|->             i2c_dbgrpt_bus_info(businfo, /*include_sysinfo*/ true, 0);
#  637|   
#  638|            }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def390]
ddcutil-2.2.1/src/dw/dw_udev.c:641:17: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:641:17: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/50/codeFlows/0/threadFlows/0/locations/13)
#  639|         }
#  640|   
#  641|->       else if ( streq(cd->prop_subsystem, "drm") &&
#  642|                    streq(cd->prop_action,   "add") ) {
#  643|            DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "Processing subsystem drm, action add");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def391]
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:641:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/51/codeFlows/0/threadFlows/0/locations/13)
#  640|   
#  641|         else if ( streq(cd->prop_subsystem, "drm") &&
#  642|->                  streq(cd->prop_action,   "add") ) {
#  643|            DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "Processing subsystem drm, action add");
#  644|            Bit_Set_256  bs_udev_buses =    i2c_detect_attached_buses_as_bitset();

Error: GCC_ANALYZER_WARNING (CWE-401): [#def392]
ddcutil-2.2.1/src/dw/dw_udev.c:643:10: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:641:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:641:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:643:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:643:10: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/52/codeFlows/0/threadFlows/0/locations/13)
#  641|         else if ( streq(cd->prop_subsystem, "drm") &&
#  642|                    streq(cd->prop_action,   "add") ) {
#  643|->          DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "Processing subsystem drm, action add");
#  644|            Bit_Set_256  bs_udev_buses =    i2c_detect_attached_buses_as_bitset();
#  645|            Bit_Set_256  bs_known_buses = EMPTY_BIT_SET_256;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def393]
ddcutil-2.2.1/src/dw/dw_udev.c:644:42: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:641:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:641:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:643:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:644:42: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/53/codeFlows/0/threadFlows/0/locations/13)
#  642|                    streq(cd->prop_action,   "add") ) {
#  643|            DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "Processing subsystem drm, action add");
#  644|->          Bit_Set_256  bs_udev_buses =    i2c_detect_attached_buses_as_bitset();
#  645|            Bit_Set_256  bs_known_buses = EMPTY_BIT_SET_256;
#  646|            for (int ndx = 0; ndx < all_i2c_buses->len; ndx++) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def394]
ddcutil-2.2.1/src/dw/dw_udev.c:649:30: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:641:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:641:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:643:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:646:28: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:647:34: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:649:30: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/54/codeFlows/0/threadFlows/0/locations/13)
#  647|               I2C_Bus_Info * cur = g_ptr_array_index(all_i2c_buses, ndx);
#  648|               // need to check if valid?
#  649|->             bs_known_buses = bs256_insert(bs_known_buses, cur->busno);
#  650|            }
#  651|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def395]
ddcutil-2.2.1/src/dw/dw_udev.c:652:10: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:641:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:641:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:643:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:652:10: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/55/codeFlows/0/threadFlows/0/locations/13)
#  650|            }
#  651|   
#  652|->          DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "udev buses: %s", BS256_REPR(bs_udev_buses));
#  653|            DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "known_buses: %s", BS256_REPR(bs_known_buses));
#  654|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def396]
ddcutil-2.2.1/src/dw/dw_udev.c:653:10: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:641:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:641:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:643:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:653:10: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/57/codeFlows/0/threadFlows/0/locations/13)
#  651|   
#  652|            DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "udev buses: %s", BS256_REPR(bs_udev_buses));
#  653|->          DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "known_buses: %s", BS256_REPR(bs_known_buses));
#  654|   
#  655|            BS256 buses_added = bs256_minus(bs_udev_buses, bs_known_buses);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def397]
ddcutil-2.2.1/src/dw/dw_udev.c:655:30: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:641:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:641:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:643:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:655:30: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/59/codeFlows/0/threadFlows/0/locations/13)
#  653|            DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "known_buses: %s", BS256_REPR(bs_known_buses));
#  654|   
#  655|->          BS256 buses_added = bs256_minus(bs_udev_buses, bs_known_buses);
#  656|            DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "Buses added: %s", BS256_REPR(buses_added));
#  657|            if (bs256_count(buses_added) > 0) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def398]
ddcutil-2.2.1/src/dw/dw_udev.c:656:10: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:641:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:641:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:643:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:656:10: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/60/codeFlows/0/threadFlows/0/locations/13)
#  654|   
#  655|            BS256 buses_added = bs256_minus(bs_udev_buses, bs_known_buses);
#  656|->          DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "Buses added: %s", BS256_REPR(buses_added));
#  657|            if (bs256_count(buses_added) > 0) {
#  658|               Bit_Set_256_Iterator iter = bs256_iter_new(buses_added);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def399]
ddcutil-2.2.1/src/dw/dw_udev.c:657:14: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:641:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:641:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:643:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:657:14: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/62/codeFlows/0/threadFlows/0/locations/13)
#  655|            BS256 buses_added = bs256_minus(bs_udev_buses, bs_known_buses);
#  656|            DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "Buses added: %s", BS256_REPR(buses_added));
#  657|->          if (bs256_count(buses_added) > 0) {
#  658|               Bit_Set_256_Iterator iter = bs256_iter_new(buses_added);
#  659|               while (true) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def400]
ddcutil-2.2.1/src/dw/dw_udev.c:658:41: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:641:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:641:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:643:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:657:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:658:41: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:658:41: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/63/codeFlows/0/threadFlows/0/locations/13)
#  656|            DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "Buses added: %s", BS256_REPR(buses_added));
#  657|            if (bs256_count(buses_added) > 0) {
#  658|->             Bit_Set_256_Iterator iter = bs256_iter_new(buses_added);
#  659|               while (true) {
#  660|                  int busno = bs256_iter_next(iter);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def401]
ddcutil-2.2.1/src/dw/dw_udev.c:660:28: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:641:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:641:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:643:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:657:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:658:41: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:660:28: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/64/codeFlows/0/threadFlows/0/locations/13)
#  658|               Bit_Set_256_Iterator iter = bs256_iter_new(buses_added);
#  659|               while (true) {
#  660|->                int busno = bs256_iter_next(iter);
#  661|                  if (busno < 0)
#  662|                     break;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def402]
ddcutil-2.2.1/src/dw/dw_udev.c:663:41: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:641:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:641:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:643:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:657:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:658:41: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:661:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:663:41: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:663:41: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/65/codeFlows/0/threadFlows/0/locations/13)
#  661|                  if (busno < 0)
#  662|                     break;
#  663|->                I2C_Bus_Info * businfo = i2c_get_and_check_bus_info(busno);
#  664|                  // I2C_Bus_Info * businfo = i2c_add_bus(busno);
#  665|                  // i2c_check_bus2(businfo);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def403]
ddcutil-2.2.1/src/dw/dw_udev.c:666:16: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:641:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:641:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:643:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:657:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:658:41: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:661:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:663:41: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:666:16: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/66/codeFlows/0/threadFlows/0/locations/13)
#  664|                  // I2C_Bus_Info * businfo = i2c_add_bus(busno);
#  665|                  // i2c_check_bus2(businfo);
#  666|->                i2c_dbgrpt_bus_info(businfo, /* include_sysinfo */ true, 2);
#  667|                  DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "Adding businfo record for /dev/"I2C"-%d", busno);
#  668|               }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def404]
ddcutil-2.2.1/src/dw/dw_udev.c:667:16: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:641:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:642:18: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:641:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:643:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:657:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:658:41: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:661:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:663:41: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:667:16: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/67/codeFlows/0/threadFlows/0/locations/13)
#  665|                  // i2c_check_bus2(businfo);
#  666|                  i2c_dbgrpt_bus_info(businfo, /* include_sysinfo */ true, 2);
#  667|->                DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "Adding businfo record for /dev/"I2C"-%d", busno);
#  668|               }
#  669|            }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def405]
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/68/codeFlows/0/threadFlows/0/locations/13)
#  670|         }
#  671|   
#  672|->       else if ( streq(cd->prop_subsystem,  "drm") &&
#  673|                   streq(cd->prop_action,     "change") ) {
#  674|            // xxx("drm change");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def406]
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/69/codeFlows/0/threadFlows/0/locations/13)
#  671|   
#  672|         else if ( streq(cd->prop_subsystem,  "drm") &&
#  673|->                 streq(cd->prop_action,     "change") ) {
#  674|            // xxx("drm change");
#  675|            bool processed = false;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def407]
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/70/codeFlows/0/threadFlows/0/locations/13)
#  675|            bool processed = false;
#  676|            time_t prev_change_timestamp = last_drm_change_timestamp;
#  677|->          last_drm_change_timestamp = cur_realtime_nanosec();
#  678|            time_t delta_time = last_drm_change_timestamp - prev_change_timestamp;
#  679|            DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "nanosec since prev drm/change event: %jd", delta_time);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def408]
ddcutil-2.2.1/src/dw/dw_udev.c:679:10: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:679:10: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/71/codeFlows/0/threadFlows/0/locations/13)
#  677|            last_drm_change_timestamp = cur_realtime_nanosec();
#  678|            time_t delta_time = last_drm_change_timestamp - prev_change_timestamp;
#  679|->          DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "nanosec since prev drm/change event: %jd", delta_time);
#  680|            if (use_sysfs_connector_id) {
#  681|               char * cname = NULL;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def409]
ddcutil-2.2.1/src/dw/dw_udev.c:683:23: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:680:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:682:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:23: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/72/codeFlows/0/threadFlows/0/locations/13)
#  681|               char * cname = NULL;
#  682|               int connector_number = -1;
#  683|->             if (cd && streq(cd->prop_action, "change")
#  684|                                   && cd->prop_connector) {  // seen null when MST hub added
#  685|                  bool valid_number = str_to_int(cd->prop_connector, &connector_number, 10);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def410]
ddcutil-2.2.1/src/dw/dw_udev.c:685:36: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:680:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:682:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:684:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:685:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:685:36: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/73/codeFlows/0/threadFlows/0/locations/13)
#  683|               if (cd && streq(cd->prop_action, "change")
#  684|                                   && cd->prop_connector) {  // seen null when MST hub added
#  685|->                bool valid_number = str_to_int(cd->prop_connector, &connector_number, 10);
#  686|                  assert(valid_number);
#  687|                  cname = get_sys_drm_connector_name_by_connector_id(connector_number);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def411]
ddcutil-2.2.1/src/dw/dw_udev.c:687:24: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:680:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:682:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:684:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:685:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:686:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:687:24: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:687:24: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/74/codeFlows/0/threadFlows/0/locations/13)
#  685|                  bool valid_number = str_to_int(cd->prop_connector, &connector_number, 10);
#  686|                  assert(valid_number);
#  687|->                cname = get_sys_drm_connector_name_by_connector_id(connector_number);
#  688|                  DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE,
#  689|                        "get_sys_drm_connector_name_by_connector_id() returned: %s", cname);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def412]
ddcutil-2.2.1/src/dw/dw_udev.c:688:16: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:680:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:682:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:684:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:685:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:686:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:687:24: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:688:16: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/75/codeFlows/0/threadFlows/0/locations/13)
#  686|                  assert(valid_number);
#  687|                  cname = get_sys_drm_connector_name_by_connector_id(connector_number);
#  688|->                DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE,
#  689|                        "get_sys_drm_connector_name_by_connector_id() returned: %s", cname);
#  690|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def413]
ddcutil-2.2.1/src/dw/dw_udev.c:696:19: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:680:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:682:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:684:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:683:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:685:36: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:686:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:687:24: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:695:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:696:19: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:696:19: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/76/codeFlows/0/threadFlows/0/locations/13)
#  694|   
#  695|                  if (cname) {
#  696|->                   DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "1) Using connector id %d, name =%s", connector_number, cname);
#  697|                     bs_cur_buses_w_edid = dw_i2c_check_bus_changes_for_connector(
#  698|                                           connector_number, cname, bs_cur_buses_w_edid,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def414]
ddcutil-2.2.1/src/dw/dw_udev.c:742:13: warning[-Wanalyzer-malloc-leak]: leak of 'collect_udev_event_detail(dev)'
ddcutil-2.2.1/src/dw/dw_udev.c:455:10: enter_function: entry to 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:461:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:533:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:534:16: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:536:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:537:10: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:540:14: branch_false: following 'false' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:592:7: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: call_function: calling 'collect_udev_event_detail' from 'dw_watch_displays_udev'
ddcutil-2.2.1/src/dw/dw_udev.c:607:32: return_function: returning to 'dw_watch_displays_udev' from 'collect_udev_event_detail'
ddcutil-2.2.1/src/dw/dw_udev.c:608:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:609:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:672:15: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:673:17: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:672:17: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dw/dw_udev.c:677:38: branch_true: ...to here
ddcutil-2.2.1/src/dw/dw_udev.c:742:13: danger: 'collect_udev_event_detail(dev)' leaks here; was allocated at [(14)](sarif:/runs/0/results/77/codeFlows/0/threadFlows/0/locations/13)
#  740|   
#  741|            if (!processed) {
#  742|->             DBGTRC_NOPREFIX(true, DDCA_TRC_NONE, "4) Calling ddc_i2c_check_bus_changes");
#  743|               // emits display change events or queues them
#  744|               bs_cur_buses_w_edid = dw_i2c_check_bus_changes(bs_cur_buses_w_edid, deferred_events);

Error: CPPCHECK_WARNING (CWE-476): [#def415]
ddcutil-2.2.1/src/dw/dw_xevent.c:57: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: evdata
#   55|      // check for extension
#   56|      XEvent_Data * evdata = calloc(1, sizeof(XEvent_Data));
#   57|->    evdata->dpy = XOpenDisplay(NULL);
#   58|      if (!evdata->dpy)
#   59|         goto bye;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def416]
ddcutil-2.2.1/src/dw/dw_xevent.c:57:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'evdata'
ddcutil-2.2.1/src/dw/dw_xevent.c:56:27: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/dw/dw_xevent.c:57:4: danger: 'evdata' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   55|      // check for extension
#   56|      XEvent_Data * evdata = calloc(1, sizeof(XEvent_Data));
#   57|->    evdata->dpy = XOpenDisplay(NULL);
#   58|      if (!evdata->dpy)
#   59|         goto bye;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def417]
ddcutil-2.2.1/src/dw/dw_xevent.c:57:18: warning[-Wanalyzer-malloc-leak]: leak of 'evdata'
ddcutil-2.2.1/src/dw/dw_xevent.c:56:27: acquire_memory: allocated here
ddcutil-2.2.1/src/dw/dw_xevent.c:57:18: danger: 'evdata' leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#   55|      // check for extension
#   56|      XEvent_Data * evdata = calloc(1, sizeof(XEvent_Data));
#   57|->    evdata->dpy = XOpenDisplay(NULL);
#   58|      if (!evdata->dpy)
#   59|         goto bye;

Error: CPPCHECK_WARNING (CWE-476): [#def418]
ddcutil-2.2.1/src/dw/dw_xevent.c:58: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: evdata
#   56|      XEvent_Data * evdata = calloc(1, sizeof(XEvent_Data));
#   57|      evdata->dpy = XOpenDisplay(NULL);
#   58|->    if (!evdata->dpy)
#   59|         goto bye;
#   60|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def419]
ddcutil-2.2.1/src/dw/dw_xevent.c:64:19: warning[-Wanalyzer-malloc-leak]: leak of 'evdata'
ddcutil-2.2.1/src/dw/dw_xevent.c:56:27: acquire_memory: allocated here
ddcutil-2.2.1/src/dw/dw_xevent.c:58:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dw/dw_xevent.c:61:21: branch_false: ...to here
ddcutil-2.2.1/src/dw/dw_xevent.c:64:19: danger: 'evdata' leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#   62|      evdata->w = RootWindow(evdata->dpy, evdata->screen);
#   63|   
#   64|->    bool have_rr = XRRQueryExtension(evdata->dpy, &evdata->rr_event_base, &evdata->rr_error_base);
#   65|      if (have_rr) {
#   66|         int maj = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def420]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:206: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fset
#  204|   
#  205|      Dyn_Feature_Set * fset = calloc(1,sizeof(Dyn_Feature_Set));
#  206|->    memcpy(fset->marker, DYN_FEATURE_SET_MARKER, 4);
#  207|      fset->subset = subset_id;
#  208|      fset->members_dfm = members_dfm;

Error: CPPCHECK_WARNING (CWE-476): [#def421]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:207: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fset
#  205|      Dyn_Feature_Set * fset = calloc(1,sizeof(Dyn_Feature_Set));
#  206|      memcpy(fset->marker, DYN_FEATURE_SET_MARKER, 4);
#  207|->    fset->subset = subset_id;
#  208|      fset->members_dfm = members_dfm;
#  209|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def422]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:207:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:205:29: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:207:4: danger: 'fset' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  205|      Dyn_Feature_Set * fset = calloc(1,sizeof(Dyn_Feature_Set));
#  206|      memcpy(fset->marker, DYN_FEATURE_SET_MARKER, 4);
#  207|->    fset->subset = subset_id;
#  208|      fset->members_dfm = members_dfm;
#  209|   

Error: CPPCHECK_WARNING (CWE-476): [#def423]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:208: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fset
#  206|      memcpy(fset->marker, DYN_FEATURE_SET_MARKER, 4);
#  207|      fset->subset = subset_id;
#  208|->    fset->members_dfm = members_dfm;
#  209|   
#  210|      DBGTRC_DONE(debug, TRACE_GROUP, "Returning %p", fset);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def424]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:210:4: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:205:29: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:210:4: danger: 'fset' leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  208|      fset->members_dfm = members_dfm;
#  209|   
#  210|->    DBGTRC_DONE(debug, TRACE_GROUP, "Returning %p", fset);
#  211|      return fset;
#  212|   }

Error: CPPCHECK_WARNING (CWE-476): [#def425]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:224: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fset
#  222|   
#  223|      Dyn_Feature_Set * fset = calloc(1,sizeof(Dyn_Feature_Set));
#  224|->    memcpy(fset->marker, DYN_FEATURE_SET_MARKER, 4);
#  225|      fset->subset = subset_id;
#  226|      fset->members_dfm = members_dfm;

Error: CPPCHECK_WARNING (CWE-476): [#def426]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:225: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fset
#  223|      Dyn_Feature_Set * fset = calloc(1,sizeof(Dyn_Feature_Set));
#  224|      memcpy(fset->marker, DYN_FEATURE_SET_MARKER, 4);
#  225|->    fset->subset = subset_id;
#  226|      fset->members_dfm = members_dfm;
#  227|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def427]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:225:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:223:29: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:225:4: danger: 'fset' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  223|      Dyn_Feature_Set * fset = calloc(1,sizeof(Dyn_Feature_Set));
#  224|      memcpy(fset->marker, DYN_FEATURE_SET_MARKER, 4);
#  225|->    fset->subset = subset_id;
#  226|      fset->members_dfm = members_dfm;
#  227|   

Error: CPPCHECK_WARNING (CWE-476): [#def428]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:226: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fset
#  224|      memcpy(fset->marker, DYN_FEATURE_SET_MARKER, 4);
#  225|      fset->subset = subset_id;
#  226|->    fset->members_dfm = members_dfm;
#  227|   
#  228|      DBGTRC_DONE(debug, TRACE_GROUP, "Returning %p", fset);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def429]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:228:4: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:223:29: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:228:4: danger: 'fset' leaks here; was allocated at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#  226|      fset->members_dfm = members_dfm;
#  227|   
#  228|->    DBGTRC_DONE(debug, TRACE_GROUP, "Returning %p", fset);
#  229|      return fset;
#  230|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def430]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:256:4: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:387:1: enter_function: entry to 'create_vcp_feature_set'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:446:11: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:453:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:454:48: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:455:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:457:16: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:458:24: call_function: calling 'test_show_feature' from 'create_vcp_feature_set'
#  254|   {
#  255|      bool debug = false;
#  256|->    DBGTRC_STARTING(debug, TRACE_GROUP, "subset_id=%d - %s, feature_set_flags=0x%02x - %s",
#  257|                     subset_id,
#  258|                     feature_subset_name(subset_id),

Error: GCC_ANALYZER_WARNING (CWE-401): [#def431]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:261:4: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:387:1: enter_function: entry to 'create_vcp_feature_set'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:446:11: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:453:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:454:48: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:455:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:457:16: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:458:24: call_function: calling 'test_show_feature' from 'create_vcp_feature_set'
#  259|                     feature_set_flags,
#  260|                     feature_set_flag_names_t(feature_set_flags));
#  261|->    DBGTRC_NOPREFIX(debug, TRACE_GROUP, "vcp_spec_groups=0x%04x, feature_flags=%s, vcp_subsets=%s",
#  262|                      vcp_spec_groups, feature_flags, vcp_subsets);
#  263|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def432]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:360:5: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:387:1: enter_function: entry to 'create_vcp_feature_set'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:446:11: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:453:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:454:48: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:455:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:457:16: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:458:24: call_function: calling 'test_show_feature' from 'create_vcp_feature_set'
#  358|       }
#  359|   
#  360|->     DBGTRC_RET_BOOL(debug, TRACE_GROUP, showit, "");
#  361|      return showit;
#  362|   }

Error: CPPCHECK_WARNING (CWE-476): [#def433]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:407: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fset
#  405|   
#  406|      struct vcp_feature_set * fset = calloc(1,sizeof(struct vcp_feature_set));
#  407|->    memcpy(fset->marker, VCP_FEATURE_SET_MARKER, 4);
#  408|      fset->subset = subset_id;
#  409|   

Error: CPPCHECK_WARNING (CWE-476): [#def434]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:408: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fset
#  406|      struct vcp_feature_set * fset = calloc(1,sizeof(struct vcp_feature_set));
#  407|      memcpy(fset->marker, VCP_FEATURE_SET_MARKER, 4);
#  408|->    fset->subset = subset_id;
#  409|   
#  410|      fset->members = g_ptr_array_sized_new(250);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def435]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:408:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:408:4: danger: 'fset' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/4)
#  406|      struct vcp_feature_set * fset = calloc(1,sizeof(struct vcp_feature_set));
#  407|      memcpy(fset->marker, VCP_FEATURE_SET_MARKER, 4);
#  408|->    fset->subset = subset_id;
#  409|   
#  410|      fset->members = g_ptr_array_sized_new(250);

Error: CPPCHECK_WARNING (CWE-476): [#def436]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:410: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fset
#  408|      fset->subset = subset_id;
#  409|   
#  410|->    fset->members = g_ptr_array_sized_new(250);
#  411|      if (subset_id == VCP_SUBSET_SCAN || subset_id == VCP_SUBSET_MFG) {
#  412|         int ndx = 1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def437]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:410:20: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:410:20: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/4)
#  408|      fset->subset = subset_id;
#  409|   
#  410|->    fset->members = g_ptr_array_sized_new(250);
#  411|      if (subset_id == VCP_SUBSET_SCAN || subset_id == VCP_SUBSET_MFG) {
#  412|         int ndx = 1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def438]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:419:47: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:413:10: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:415:14: branch_true: following 'true' branch (when 'ndx != 256')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:416:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:419:47: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/4)
#  417|            // DBGMSF(debug, "examining id 0x%02x", id);
#  418|            // n. this is a pointer into permanent data structures, should not be freed:
#  419|->          VCP_Feature_Table_Entry* vcp_entry = vcp_find_feature_by_hexid(id);
#  420|            // original code looks at VCP2_READABLE, output level
#  421|            if (vcp_entry) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def439]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:423:18: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:413:10: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:415:14: branch_true: following 'true' branch (when 'ndx != 256')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:416:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:421:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:423:18: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:423:18: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/15/codeFlows/0/threadFlows/0/locations/4)
#  421|            if (vcp_entry) {
#  422|               bool showit = true;
#  423|->             if ( is_table_feature_by_vcp_version(vcp_entry, vcp_version) ) {
#  424|                  if ( /* get_output_level() < DDCA_OL_VERBOSE || */
#  425|                       exclude_table_features  )

Error: GCC_ANALYZER_WARNING (CWE-401): [#def440]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:428:18: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:413:10: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:415:14: branch_true: following 'true' branch (when 'ndx != 256')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:416:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:428:18: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/16/codeFlows/0/threadFlows/0/locations/4)
#  426|                     showit = false;
#  427|               }
#  428|->             if (!is_feature_readable_by_vcp_version(vcp_entry, vcp_version)) {
#  429|                  showit = false;
#  430|               }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def441]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:432:16: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:413:10: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:415:14: branch_true: following 'true' branch (when 'ndx != 256')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:416:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:432:16: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/4)
#  430|               }
#  431|               if (showit) {
#  432|->                g_ptr_array_add(fset->members, vcp_entry);
#  433|               }
#  434|            }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def442]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:436:13: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:413:10: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:415:14: branch_true: following 'true' branch (when 'ndx != 256')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:416:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:421:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:436:44: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:436:13: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/4)
#  434|            }
#  435|            else {  // unknown feature or manufacturer specific feature
#  436|->             g_ptr_array_add(fset->members, vcp_create_dummy_feature_for_hexid(id));
#  437|               if (ndx >= 0xe0 && (get_output_level() >= DDCA_OL_VERBOSE && !exclude_table_features) ) {
#  438|                  // for manufacturer specific features, probe as both table and non-table

Error: GCC_ANALYZER_WARNING (CWE-401): [#def443]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:436:44: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:413:10: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:415:14: branch_true: following 'true' branch (when 'ndx != 256')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:416:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:421:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:436:44: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:436:44: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/4)
#  434|            }
#  435|            else {  // unknown feature or manufacturer specific feature
#  436|->             g_ptr_array_add(fset->members, vcp_create_dummy_feature_for_hexid(id));
#  437|               if (ndx >= 0xe0 && (get_output_level() >= DDCA_OL_VERBOSE && !exclude_table_features) ) {
#  438|                  // for manufacturer specific features, probe as both table and non-table

Error: GCC_ANALYZER_WARNING (CWE-401): [#def444]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:437:33: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:413:10: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:415:14: branch_true: following 'true' branch (when 'ndx != 256')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:416:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:421:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:436:44: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:437:16: branch_true: following 'true' branch (when 'ndx > 223')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:437:33: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:437:33: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/20/codeFlows/0/threadFlows/0/locations/4)
#  435|            else {  // unknown feature or manufacturer specific feature
#  436|               g_ptr_array_add(fset->members, vcp_create_dummy_feature_for_hexid(id));
#  437|->             if (ndx >= 0xe0 && (get_output_level() >= DDCA_OL_VERBOSE && !exclude_table_features) ) {
#  438|                  // for manufacturer specific features, probe as both table and non-table
#  439|                  // Only probe table if --verbose, output is confusing otherwise

Error: GCC_ANALYZER_WARNING (CWE-401): [#def445]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:440:16: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:413:10: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:415:14: branch_true: following 'true' branch (when 'ndx != 256')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:416:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:421:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:436:44: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:437:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:440:16: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/21/codeFlows/0/threadFlows/0/locations/4)
#  438|                  // for manufacturer specific features, probe as both table and non-table
#  439|                  // Only probe table if --verbose, output is confusing otherwise
#  440|->                g_ptr_array_add(fset->members, vcp_create_table_dummy_feature_for_hexid(id));
#  441|               }
#  442|            }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def446]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:440:47: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:413:10: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:415:14: branch_true: following 'true' branch (when 'ndx != 256')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:416:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:421:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:436:44: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:437:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:440:47: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/22/codeFlows/0/threadFlows/0/locations/4)
#  438|                  // for manufacturer specific features, probe as both table and non-table
#  439|                  // Only probe table if --verbose, output is confusing otherwise
#  440|->                g_ptr_array_add(fset->members, vcp_create_table_dummy_feature_for_hexid(id));
#  441|               }
#  442|            }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def447]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:448:10: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:446:11: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:446:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:448:10: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:448:10: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/4)
#  446|         if (subset_id == VCP_SUBSET_TABLE || subset_id == VCP_SUBSET_LUT) {
#  447|            exclude_table_features = false;
#  448|->          DBGTRC_NOPREFIX(debug, TRACE_GROUP, "Reset exclude_table_features = %s",
#  449|                                                SBOOL(exclude_table_features));
#  450|         }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def448]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:451:30: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:446:11: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:451:30: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/24/codeFlows/0/threadFlows/0/locations/4)
#  449|                                                SBOOL(exclude_table_features));
#  450|         }
#  451|->       int known_feature_ct = vcp_get_feature_code_count();
#  452|         int ndx = 0;
#  453|         for (ndx=0; ndx < known_feature_ct; ndx++) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def449]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:454:48: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:446:11: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:453:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:454:48: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:454:48: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/25/codeFlows/0/threadFlows/0/locations/4)
#  452|         int ndx = 0;
#  453|         for (ndx=0; ndx < known_feature_ct; ndx++) {
#  454|->          VCP_Feature_Table_Entry * vcp_entry = vcp_get_feature_table_entry(ndx);
#  455|            assert(vcp_entry);
#  456|            DDCA_Version_Feature_Flags vflags =

Error: GCC_ANALYZER_WARNING (CWE-401): [#def450]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:457:16: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:411:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:446:11: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:453:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:454:48: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:455:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:457:16: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:457:16: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/26/codeFlows/0/threadFlows/0/locations/4)
#  455|            assert(vcp_entry);
#  456|            DDCA_Version_Feature_Flags vflags =
#  457|->                get_version_sensitive_feature_flags(vcp_entry, vcp_version);
#  458|            bool showit = test_show_feature(
#  459|                  subset_id,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def451]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:471:4: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:392:4: branch_false: following 'false' branch (when 'subset_id != 0')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:393:4: branch_false: following 'false' branch (when 'subset_id != 2')...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:397:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:406:36: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:453:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:471:4: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:471:4: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/27/codeFlows/0/threadFlows/0/locations/4)
#  469|   
#  470|      assert(fset);
#  471|->    DBGTRC_DONE(debug, TRACE_GROUP, "Returning: %p", fset);
#  472|      if (IS_DBGTRC(debug, TRACE_GROUP))
#  473|         dbgrpt_vcp_feature_set(fset, 1);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def452]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:675:28: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:667:5: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:669:9: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:669:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:672:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:672:15: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:673:8: branch_false: following 'false' branch (when 'fset' is non-NULL)...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:674:15: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:675:28: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/28/codeFlows/0/threadFlows/0/locations/4)
#  673|          assert(fset);     // avoid coverity "Dereference before null check" warning
#  674|          memcpy(fset->marker, DYN_FEATURE_SET_MARKER, 4);
#  675|->        fset->members_dfm = g_ptr_array_sized_new(1);
#  676|          fset->subset = fsref->subset;
#  677|          Bit_Set_256_Iterator iter = bs256_iter_new(fsref->features);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def453]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:677:36: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:667:5: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:669:9: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:669:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:672:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:672:15: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:673:8: branch_false: following 'false' branch (when 'fset' is non-NULL)...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:674:15: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:677:36: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/29/codeFlows/0/threadFlows/0/locations/4)
#  675|          fset->members_dfm = g_ptr_array_sized_new(1);
#  676|          fset->subset = fsref->subset;
#  677|->        Bit_Set_256_Iterator iter = bs256_iter_new(fsref->features);
#  678|          int feature_code = -1;
#  679|          while ( (feature_code = bs256_iter_next(iter)) >= 0 ) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def454]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:679:32: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:667:5: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:669:9: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:669:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:672:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:672:15: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:673:8: branch_false: following 'false' branch (when 'fset' is non-NULL)...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:674:15: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:679:32: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/30/codeFlows/0/threadFlows/0/locations/4)
#  677|          Bit_Set_256_Iterator iter = bs256_iter_new(fsref->features);
#  678|          int feature_code = -1;
#  679|->        while ( (feature_code = bs256_iter_next(iter)) >= 0 ) {
#  680|             Byte hexid = (Byte) feature_code;
#  681|             // Display_Feature_Metadata * vcp_entry = vcp_find_feature_by_hexid_w_default(hexid);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def455]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:682:50: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:667:5: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:669:9: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:669:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:672:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:672:15: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:673:8: branch_false: following 'false' branch (when 'fset' is non-NULL)...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:674:15: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:679:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:680:16: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:682:50: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/31/codeFlows/0/threadFlows/0/locations/4)
#  680|             Byte hexid = (Byte) feature_code;
#  681|             // Display_Feature_Metadata * vcp_entry = vcp_find_feature_by_hexid_w_default(hexid);
#  682|->           Display_Feature_Metadata * dfm_entry = dyn_get_feature_metadata_by_dref(
#  683|                                                 hexid,
#  684|                                                 NULL,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def456]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:687:11: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:667:5: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:669:9: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:669:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:672:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:672:15: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:673:8: branch_false: following 'false' branch (when 'fset' is non-NULL)...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:674:15: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:679:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:680:16: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:687:11: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/32/codeFlows/0/threadFlows/0/locations/4)
#  685|                                                 flags & FSF_CHECK_UDF,
#  686|                                                 true);    // with_default
#  687|->           g_ptr_array_add(fset->members_dfm, dfm_entry);
#  688|          }
#  689|          bs256_iter_free(iter);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def457]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:689:8: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:667:5: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:669:9: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:669:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:672:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:672:15: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:673:8: branch_false: following 'false' branch (when 'fset' is non-NULL)...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:674:15: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:689:8: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/33/codeFlows/0/threadFlows/0/locations/4)
#  687|             g_ptr_array_add(fset->members_dfm, dfm_entry);
#  688|          }
#  689|->        bs256_iter_free(iter);
#  690|       }
#  691|       else {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def458]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:695:5: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:667:5: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:669:9: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:669:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:672:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:672:15: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:673:8: branch_false: following 'false' branch (when 'fset' is non-NULL)...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:674:15: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:695:5: danger: 'fset' leaks here; was allocated at [(5)](sarif:/runs/0/results/34/codeFlows/0/threadFlows/0/locations/4)
#  693|       }
#  694|   
#  695|->     DBGTRC_DONE(debug, TRACE_GROUP, "Returning fset %p", fset);
#  696|       if (IS_DBGTRC(debug, TRACE_GROUP))
#  697|          dbgrpt_dyn_feature_set(fset, false, 1);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def459]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:749:24: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:743:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:746:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:746:15: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:747:8: branch_false: following 'false' branch (when 'fset' is non-NULL)...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:748:15: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:749:24: danger: 'fset' leaks here; was allocated at [(3)](sarif:/runs/0/results/35/codeFlows/0/threadFlows/0/locations/2)
#  747|          assert(fset);     // avoid coverity "Dereference before null check" warning
#  748|          memcpy(fset->marker, VCP_FEATURE_SET_MARKER, 4);
#  749|->        fset->members = g_ptr_array_sized_new(1);
#  750|          fset->subset = fsref->subset;
#  751|          Bit_Set_256_Iterator iter = bs256_iter_new(fsref->features);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def460]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:751:36: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:743:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:746:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:746:15: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:747:8: branch_false: following 'false' branch (when 'fset' is non-NULL)...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:748:15: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:751:36: danger: 'fset' leaks here; was allocated at [(3)](sarif:/runs/0/results/36/codeFlows/0/threadFlows/0/locations/2)
#  749|          fset->members = g_ptr_array_sized_new(1);
#  750|          fset->subset = fsref->subset;
#  751|->        Bit_Set_256_Iterator iter = bs256_iter_new(fsref->features);
#  752|          int feature_code = -1;
#  753|          while ( (feature_code = bs256_iter_next(iter)) >= 0 ) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def461]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:753:32: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:743:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:746:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:746:15: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:747:8: branch_false: following 'false' branch (when 'fset' is non-NULL)...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:748:15: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:753:32: danger: 'fset' leaks here; was allocated at [(3)](sarif:/runs/0/results/37/codeFlows/0/threadFlows/0/locations/2)
#  751|          Bit_Set_256_Iterator iter = bs256_iter_new(fsref->features);
#  752|          int feature_code = -1;
#  753|->        while ( (feature_code = bs256_iter_next(iter)) >= 0 ) {
#  754|             Byte hexid = (Byte) feature_code;
#  755|             VCP_Feature_Table_Entry* vcp_entry = vcp_find_feature_by_hexid_w_default(hexid);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def462]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:755:48: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:743:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:746:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:746:15: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:747:8: branch_false: following 'false' branch (when 'fset' is non-NULL)...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:748:15: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:753:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:754:16: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:755:48: danger: 'fset' leaks here; was allocated at [(3)](sarif:/runs/0/results/38/codeFlows/0/threadFlows/0/locations/2)
#  753|          while ( (feature_code = bs256_iter_next(iter)) >= 0 ) {
#  754|             Byte hexid = (Byte) feature_code;
#  755|->           VCP_Feature_Table_Entry* vcp_entry = vcp_find_feature_by_hexid_w_default(hexid);
#  756|             g_ptr_array_add(fset->members, vcp_entry);
#  757|          }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def463]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:756:11: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:743:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:746:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:746:15: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:747:8: branch_false: following 'false' branch (when 'fset' is non-NULL)...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:748:15: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:753:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:754:16: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:756:11: danger: 'fset' leaks here; was allocated at [(3)](sarif:/runs/0/results/39/codeFlows/0/threadFlows/0/locations/2)
#  754|             Byte hexid = (Byte) feature_code;
#  755|             VCP_Feature_Table_Entry* vcp_entry = vcp_find_feature_by_hexid_w_default(hexid);
#  756|->           g_ptr_array_add(fset->members, vcp_entry);
#  757|          }
#  758|          bs256_iter_free(iter);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def464]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:758:8: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:743:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:746:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:746:15: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:747:8: branch_false: following 'false' branch (when 'fset' is non-NULL)...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:748:15: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:758:8: danger: 'fset' leaks here; was allocated at [(3)](sarif:/runs/0/results/40/codeFlows/0/threadFlows/0/locations/2)
#  756|             g_ptr_array_add(fset->members, vcp_entry);
#  757|          }
#  758|->        bs256_iter_free(iter);
#  759|       }
#  760|       else {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def465]
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:764:5: warning[-Wanalyzer-malloc-leak]: leak of 'fset'
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:743:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:746:15: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:746:15: acquire_memory: allocated here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:747:8: branch_false: following 'false' branch (when 'fset' is non-NULL)...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:748:15: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:764:5: branch_false: following 'false' branch...
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:764:5: branch_false: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_feature_set.c:764:5: danger: 'fset' leaks here; was allocated at [(3)](sarif:/runs/0/results/41/codeFlows/0/threadFlows/0/locations/2)
#  762|       }
#  763|   
#  764|->     DBGTRC_RET_STRUCT(debug, TRACE_GROUP, "Vcp_Feature_Set", dbgrpt_vcp_feature_set, fset);
#  765|       return fset;
#  766|   }

Error: CPPCHECK_WARNING (CWE-682): [#def466]
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:399: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  397|                  int required_size = 3 * ct;
#  398|                  buf0 = malloc(required_size);
#  399|->                char * bufend = buf0+required_size;
#  400|   
#  401|                  char * pos = buf0;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def467]
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:404:31: warning[-Wanalyzer-malloc-leak]: leak of 'pos'
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:512:1: enter_function: entry to 'dyn_report_cap_features'
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:541:16: branch_true: following 'true' branch (when 'ndx < ct')...
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:542:43: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:544:7: call_function: calling 'dyn_report_one_cap_feature' from 'dyn_report_cap_features'
#  402|                  int ndx = 0;
#  403|                  for (; ndx < ct; ndx++) {
#  404|->                   Byte hval = bva_get(vfr->values, ndx);
#  405|                     snprintf(pos, bufend-pos, "%02X ", hval);
#  406|                     pos = pos+3;

Error: GCC_ANALYZER_WARNING (CWE-124): [#def468]
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:408:16: warning[-Wanalyzer-out-of-bounds]: heap-based buffer underwrite
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:512:1: enter_function: entry to 'dyn_report_cap_features'
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:541:16: branch_true: following 'true' branch (when 'ndx < ct')...
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:542:43: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:544:7: call_function: calling 'dyn_report_one_cap_feature' from 'dyn_report_cap_features'
#  406|                     pos = pos+3;
#  407|                  }
#  408|->                *(pos-1) = '\0';
#  409|                  if (ol >= DDCA_OL_VERBOSE)
#  410|                     rpt_vstring(d1, "Values (  parsed): %s (interpretation unavailable)", buf0);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def469]
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:408:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'pos'
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:512:1: enter_function: entry to 'dyn_report_cap_features'
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:541:16: branch_true: following 'true' branch (when 'ndx < ct')...
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:542:43: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:544:7: call_function: calling 'dyn_report_one_cap_feature' from 'dyn_report_cap_features'
#  406|                     pos = pos+3;
#  407|                  }
#  408|->                *(pos-1) = '\0';
#  409|                  if (ol >= DDCA_OL_VERBOSE)
#  410|                     rpt_vstring(d1, "Values (  parsed): %s (interpretation unavailable)", buf0);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def470]
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:412:19: warning[-Wanalyzer-malloc-leak]: leak of 'pos'
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:512:1: enter_function: entry to 'dyn_report_cap_features'
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:541:16: branch_true: following 'true' branch (when 'ndx < ct')...
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:542:43: branch_true: ...to here
ddcutil-2.2.1/src/dynvcp/dyn_parsed_capabilities.c:544:7: call_function: calling 'dyn_report_one_cap_feature' from 'dyn_report_cap_features'
#  410|                     rpt_vstring(d1, "Values (  parsed): %s (interpretation unavailable)", buf0);
#  411|                  else
#  412|->                   rpt_vstring(d1, "Values: %s (interpretation unavailable)", buf0);
#  413|               }
#  414|            }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def471]
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:918:4: warning[-Wanalyzer-malloc-leak]: leak of 'result.connector_name'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1063:7: enter_function: entry to 'i2c_edid_exists'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1067:5: branch_true: following 'true' branch (when 'busno >= 0')...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1068:5: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1068:5: branch_true: following 'true' branch (when 'busno != 255')...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1072:5: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1080:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1084:24: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1085:8: branch_false: following 'false' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1090:10: branch_false: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1090:8: branch_false: following 'false' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1094:27: branch_false: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1099:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1101:8: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1102:38: call_function: calling 'find_sys_drm_connector_by_busno_or_edid' from 'i2c_edid_exists'
#  916|   
#  917|   void dbgrpt_found_sys_drm_connector(Found_Sys_Drm_Connector val, int depth) {
#  918|->    rpt_vstring(depth, "Found_Sys_Drm_Connector:");
#  919|      rpt_vstring(depth+1, "connector_name:   %s", val.connector_name);
#  920|      rpt_vstring(depth+1, "connector_id:     %d", val.connector_id);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def472]
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:919:4: warning[-Wanalyzer-malloc-leak]: leak of 'result.connector_name'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1063:7: enter_function: entry to 'i2c_edid_exists'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1067:5: branch_true: following 'true' branch (when 'busno >= 0')...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1068:5: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1068:5: branch_true: following 'true' branch (when 'busno != 255')...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1072:5: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1080:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1084:24: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1085:8: branch_false: following 'false' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1090:10: branch_false: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1090:8: branch_false: following 'false' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1094:27: branch_false: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1099:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1101:8: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1102:38: call_function: calling 'find_sys_drm_connector_by_busno_or_edid' from 'i2c_edid_exists'
#  917|   void dbgrpt_found_sys_drm_connector(Found_Sys_Drm_Connector val, int depth) {
#  918|      rpt_vstring(depth, "Found_Sys_Drm_Connector:");
#  919|->    rpt_vstring(depth+1, "connector_name:   %s", val.connector_name);
#  920|      rpt_vstring(depth+1, "connector_id:     %d", val.connector_id);
#  921|      rpt_vstring(depth+1, "found_by:         %s", drm_connector_found_by_name(val.found_by));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def473]
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:967:10: warning[-Wanalyzer-malloc-leak]: leak of 'cbn'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:953:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:960:35: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:963:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:963:22: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:963:22: branch_false: following 'false' branch (when 'found == 0')...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:964:22: branch_false: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:965:10: branch_true: following 'true' branch (when 'busno != -1')...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:966:40: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:966:40: acquire_memory: allocated here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:967:10: danger: 'cbn' leaks here; was allocated at [(9)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/8)
#  965|         if (check_busno) {
#  966|            Connector_Bus_Numbers * cbn = calloc(1, sizeof(Connector_Bus_Numbers));
#  967|->          get_connector_bus_numbers("/sys/class/drm", cname, cbn);
#  968|            if (cbn->i2c_busno == busno){
#  969|               found = true;

Error: CPPCHECK_WARNING (CWE-476): [#def474]
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:968: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cbn
#  966|            Connector_Bus_Numbers * cbn = calloc(1, sizeof(Connector_Bus_Numbers));
#  967|            get_connector_bus_numbers("/sys/class/drm", cname, cbn);
#  968|->          if (cbn->i2c_busno == busno){
#  969|               found = true;
#  970|               result.connector_name = strdup(cname);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def475]
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:973:13: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(cname)'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:953:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:960:35: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:963:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:963:22: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:963:22: branch_false: following 'false' branch (when 'found == 0')...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:964:22: branch_false: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:965:10: branch_true: following 'true' branch (when 'busno != -1')...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:966:40: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:968:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:970:37: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:970:37: acquire_memory: allocated here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:973:13: danger: 'strdup(cname)' leaks here; was allocated at [(11)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/10)
#  971|               result.found_by = DRM_CONNECTOR_FOUND_BY_BUSNO;
#  972|               result.connector_id = cbn->connector_id;
#  973|->             DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE,
#  974|                     "Found connector %s by i2c bus number match for bus i2c-%d", cname, busno);
#  975|            }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def476]
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:976:10: warning[-Wanalyzer-malloc-leak]: leak of 'result.connector_name'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:953:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:960:35: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:963:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:963:22: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:963:22: branch_false: following 'false' branch (when 'found == 0')...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:964:22: branch_false: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:965:10: branch_true: following 'true' branch (when 'busno != -1')...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:966:40: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:968:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:970:37: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:970:37: acquire_memory: allocated here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:976:10: danger: 'result.connector_name' leaks here; was allocated at [(11)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/10)
#  974|                     "Found connector %s by i2c bus number match for bus i2c-%d", cname, busno);
#  975|            }
#  976|->          free_connector_bus_numbers(cbn);
#  977|         }
#  978|         if (check_edid) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def477]
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:991:20: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(cname)'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1308:6: enter_function: entry to 'set_connector_for_businfo_using_edid'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1313:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1315:4: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1317:8: call_function: calling 'find_sys_drm_connector_by_busno_or_edid' from 'set_connector_for_businfo_using_edid'
#  989|                      result.connector_name = strdup(cname);
#  990|                      result.found_by = DRM_CONNECTOR_FOUND_BY_EDID;
#  991|->                    DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE,
#  992|                            "Found connector %s by EDID match for bus i2c-%d", cname, busno);
#  993|                   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def478]
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:994:17: warning[-Wanalyzer-malloc-leak]: leak of 'result.connector_name'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1308:6: enter_function: entry to 'set_connector_for_businfo_using_edid'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1313:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1315:4: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1317:8: call_function: calling 'find_sys_drm_connector_by_busno_or_edid' from 'set_connector_for_businfo_using_edid'
#  992|                            "Found connector %s by EDID match for bus i2c-%d", cname, busno);
#  993|                   }
#  994|->                 g_byte_array_free(edid_bytes_array, true);
#  995|               }
#  996|            }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def479]
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:999:4: warning[-Wanalyzer-malloc-leak]: leak of 'result.connector_name'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1308:6: enter_function: entry to 'set_connector_for_businfo_using_edid'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1313:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1315:4: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1317:8: call_function: calling 'find_sys_drm_connector_by_busno_or_edid' from 'set_connector_for_businfo_using_edid'
#  997|         }
#  998|      }
#  999|->    free_sysfs_connector_names_contents(cnames);
# 1000|   
# 1001|      if (IS_DBGTRC(debug, DDCA_TRC_NONE)) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def480]
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1001:8: warning[-Wanalyzer-malloc-leak]: leak of 'result.connector_name'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1308:6: enter_function: entry to 'set_connector_for_businfo_using_edid'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1313:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1315:4: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1317:8: call_function: calling 'find_sys_drm_connector_by_busno_or_edid' from 'set_connector_for_businfo_using_edid'
#  999|      free_sysfs_connector_names_contents(cnames);
# 1000|   
# 1001|->    if (IS_DBGTRC(debug, DDCA_TRC_NONE)) {
# 1002|         dbgrpt_found_sys_drm_connector(result, 1);
# 1003|      }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def481]
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1004:4: warning[-Wanalyzer-malloc-leak]: leak of 'result.connector_name'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1308:6: enter_function: entry to 'set_connector_for_businfo_using_edid'
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1313:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1315:4: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_bus_core.c:1317:8: call_function: calling 'find_sys_drm_connector_by_busno_or_edid' from 'set_connector_for_businfo_using_edid'
# 1002|         dbgrpt_found_sys_drm_connector(result, 1);
# 1003|      }
# 1004|->    DBGTRC_DONE(debug, DDCA_TRC_NONE, "");
# 1005|      return result;
# 1006|   }

Error: CPPCHECK_WARNING (CWE-476): [#def482]
ddcutil-2.2.1/src/i2c/i2c_edid.c:159: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: messages
#  157|            memset(&msgset,0,sizeof(msgset));  // see comment in i2c_ioctl_writer()
#  158|   
#  159|->          messages[0].addr  = 0x50;
#  160|            messages[0].flags = I2C_M_RD;
#  161|            messages[0].len   = edid_read_size;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def483]
ddcutil-2.2.1/src/i2c/i2c_edid.c:159:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'messages'
ddcutil-2.2.1/src/i2c/i2c_edid.c:78:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_edid.c:155:38: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/i2c/i2c_edid.c:159:10: danger: 'messages' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  157|            memset(&msgset,0,sizeof(msgset));  // see comment in i2c_ioctl_writer()
#  158|   
#  159|->          messages[0].addr  = 0x50;
#  160|            messages[0].flags = I2C_M_RD;
#  161|            messages[0].len   = edid_read_size;

Error: CPPCHECK_WARNING (CWE-476): [#def484]
ddcutil-2.2.1/src/i2c/i2c_edid.c:160: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: messages
#  158|   
#  159|            messages[0].addr  = 0x50;
#  160|->          messages[0].flags = I2C_M_RD;
#  161|            messages[0].len   = edid_read_size;
#  162|            messages[0].buf   = rawedid->bytes;

Error: CPPCHECK_WARNING (CWE-476): [#def485]
ddcutil-2.2.1/src/i2c/i2c_edid.c:161: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: messages
#  159|            messages[0].addr  = 0x50;
#  160|            messages[0].flags = I2C_M_RD;
#  161|->          messages[0].len   = edid_read_size;
#  162|            messages[0].buf   = rawedid->bytes;
#  163|   

Error: CPPCHECK_WARNING (CWE-476): [#def486]
ddcutil-2.2.1/src/i2c/i2c_edid.c:162: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: messages
#  160|            messages[0].flags = I2C_M_RD;
#  161|            messages[0].len   = edid_read_size;
#  162|->          messages[0].buf   = rawedid->bytes;
#  163|   
#  164|            msgset.msgs  = messages;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def487]
ddcutil-2.2.1/src/i2c/i2c_edid.c:167:10: warning[-Wanalyzer-malloc-leak]: leak of 'messages'
ddcutil-2.2.1/src/i2c/i2c_edid.c:78:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_edid.c:155:38: acquire_memory: allocated here
ddcutil-2.2.1/src/i2c/i2c_edid.c:167:10: danger: 'messages' leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#  165|            msgset.nmsgs = 1;
#  166|   
#  167|->          RECORD_IO_EVENT(
#  168|               fd,
#  169|               IE_IOCTL_READ,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def488]
ddcutil-2.2.1/src/i2c/i2c_execute.c:413:4: warning[-Wanalyzer-malloc-leak]: leak of 'messages'
ddcutil-2.2.1/src/i2c/i2c_execute.c:518:1: enter_function: entry to 'i2c_ioctl_reader1'
ddcutil-2.2.1/src/i2c/i2c_execute.c:534:32: acquire_memory: allocated here
ddcutil-2.2.1/src/i2c/i2c_execute.c:546:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/i2c/i2c_execute.c:547:7: branch_true: ...to here
ddcutil-2.2.1/src/i2c/i2c_execute.c:547:7: call_function: calling 'dbgrpt_i2c_rdwr_ioctl_data' from 'i2c_ioctl_reader1'
#  411|      bool debug = false;
#  412|      DBGMSF(debug, "data=%p", data);
#  413|->    rpt_structure_loc("i2c_rdwr_ioctl_data", data, depth);
#  414|      int d1 = depth+1;
#  415|      int d2 = depth+2;

Error: CPPCHECK_WARNING (CWE-476): [#def489]
ddcutil-2.2.1/src/i2c/i2c_execute.c:538: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: messages
#  536|      memset(&msgset,0,sizeof(msgset));  // see comment in is2_ioctl_writer()
#  537|   
#  538|->    messages[0].addr  = slave_addr;
#  539|      messages[0].flags = I2C_M_RD;
#  540|      messages[0].len   = bytect;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def490]
ddcutil-2.2.1/src/i2c/i2c_execute.c:538:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'messages'
ddcutil-2.2.1/src/i2c/i2c_execute.c:534:32: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/i2c/i2c_execute.c:538:4: danger: 'messages' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  536|      memset(&msgset,0,sizeof(msgset));  // see comment in is2_ioctl_writer()
#  537|   
#  538|->    messages[0].addr  = slave_addr;
#  539|      messages[0].flags = I2C_M_RD;
#  540|      messages[0].len   = bytect;

Error: CPPCHECK_WARNING (CWE-476): [#def491]
ddcutil-2.2.1/src/i2c/i2c_execute.c:539: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: messages
#  537|   
#  538|      messages[0].addr  = slave_addr;
#  539|->    messages[0].flags = I2C_M_RD;
#  540|      messages[0].len   = bytect;
#  541|      messages[0].buf   = readbuf;

Error: CPPCHECK_WARNING (CWE-476): [#def492]
ddcutil-2.2.1/src/i2c/i2c_execute.c:540: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: messages
#  538|      messages[0].addr  = slave_addr;
#  539|      messages[0].flags = I2C_M_RD;
#  540|->    messages[0].len   = bytect;
#  541|      messages[0].buf   = readbuf;
#  542|   

Error: CPPCHECK_WARNING (CWE-476): [#def493]
ddcutil-2.2.1/src/i2c/i2c_execute.c:541: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: messages
#  539|      messages[0].flags = I2C_M_RD;
#  540|      messages[0].len   = bytect;
#  541|->    messages[0].buf   = readbuf;
#  542|   
#  543|      msgset.msgs  = messages;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def494]
ddcutil-2.2.1/src/i2c/i2c_execute.c:546:8: warning[-Wanalyzer-malloc-leak]: leak of 'messages'
ddcutil-2.2.1/src/i2c/i2c_execute.c:534:32: acquire_memory: allocated here
ddcutil-2.2.1/src/i2c/i2c_execute.c:546:8: danger: 'messages' leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  544|      msgset.nmsgs = 1;
#  545|   
#  546|->    if (IS_DBGTRC(debug, DDCA_TRC_NONE))
#  547|         dbgrpt_i2c_rdwr_ioctl_data(1, &msgset);
#  548|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def495]
ddcutil-2.2.1/src/i2c/i2c_execute.c:549:4: warning[-Wanalyzer-malloc-leak]: leak of 'messages'
ddcutil-2.2.1/src/i2c/i2c_execute.c:534:32: acquire_memory: allocated here
ddcutil-2.2.1/src/i2c/i2c_execute.c:546:8: branch_false: following 'false' branch...
ddcutil-2.2.1/src/i2c/i2c_execute.c:549:4: branch_false: ...to here
ddcutil-2.2.1/src/i2c/i2c_execute.c:549:4: danger: 'messages' leaks here; was allocated at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#  547|         dbgrpt_i2c_rdwr_ioctl_data(1, &msgset);
#  548|   
#  549|->    RECORD_IO_EVENT(
#  550|         fd,
#  551|         IE_IOCTL_READ,

Error: CPPCHECK_WARNING (CWE-476): [#def496]
ddcutil-2.2.1/src/libmain/api_base.c:396: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cmd_name_array
#  394|      }
#  395|      Null_Terminated_String_Array cmd_name_array = calloc(2 + libopts_token_ct, sizeof(char*));
#  396|->    cmd_name_array[0] = strdup("libddcutil");   // so libddcutil not a special case for parser
#  397|      int ndx = 0;
#  398|      for (; ndx < libopts_token_ct; ndx++)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def497]
ddcutil-2.2.1/src/libmain/api_base.c:396:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cmd_name_array'
ddcutil-2.2.1/src/libmain/api_base.c:757:1: enter_function: entry to 'ddci_init'
ddcutil-2.2.1/src/libmain/api_base.c:770:7: branch_true: following 'true' branch (when 'infomsg_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_base.c:771:7: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_base.c:780:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_base.c:786:27: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_base.c:787:4: branch_false: following 'false' branch (when 'debug == 0')...
ddcutil-2.2.1/src/libmain/api_base.c:789:7: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_base.c:819:22: call_function: calling 'get_parsed_libmain_config' from 'ddci_init'
#  394|      }
#  395|      Null_Terminated_String_Array cmd_name_array = calloc(2 + libopts_token_ct, sizeof(char*));
#  396|->    cmd_name_array[0] = strdup("libddcutil");   // so libddcutil not a special case for parser
#  397|      int ndx = 0;
#  398|      for (; ndx < libopts_token_ct; ndx++)

Error: CPPCHECK_WARNING (CWE-476): [#def498]
ddcutil-2.2.1/src/libmain/api_base.c:399: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cmd_name_array
#  397|      int ndx = 0;
#  398|      for (; ndx < libopts_token_ct; ndx++)
#  399|->       cmd_name_array[ndx+1] = g_strdup(libopts_tokens[ndx]);
#  400|      cmd_name_array[ndx+1] = NULL;
#  401|      ntsa_free(libopts_tokens,true);

Error: CPPCHECK_WARNING (CWE-476): [#def499]
ddcutil-2.2.1/src/libmain/api_base.c:400: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cmd_name_array
#  398|      for (; ndx < libopts_token_ct; ndx++)
#  399|         cmd_name_array[ndx+1] = g_strdup(libopts_tokens[ndx]);
#  400|->    cmd_name_array[ndx+1] = NULL;
#  401|      ntsa_free(libopts_tokens,true);
#  402|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def500]
ddcutil-2.2.1/src/libmain/api_base.c:401:4: warning[-Wanalyzer-malloc-leak]: leak of 'cmd_name_array'
ddcutil-2.2.1/src/libmain/api_base.c:757:1: enter_function: entry to 'ddci_init'
ddcutil-2.2.1/src/libmain/api_base.c:770:7: branch_true: following 'true' branch (when 'infomsg_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_base.c:771:7: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_base.c:780:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_base.c:786:27: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_base.c:787:4: branch_false: following 'false' branch (when 'debug == 0')...
ddcutil-2.2.1/src/libmain/api_base.c:789:7: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_base.c:819:22: call_function: calling 'get_parsed_libmain_config' from 'ddci_init'
#  399|         cmd_name_array[ndx+1] = g_strdup(libopts_tokens[ndx]);
#  400|      cmd_name_array[ndx+1] = NULL;
#  401|->    ntsa_free(libopts_tokens,true);
#  402|   
#  403|      DBGF(debug, "cmd_name_array=%p, cmd_name_array[1]=%p -> %s",

Error: GCC_ANALYZER_WARNING (CWE-401): [#def501]
ddcutil-2.2.1/src/libmain/api_base.c:412:18: warning[-Wanalyzer-malloc-leak]: leak of 'cmd_name_array'
ddcutil-2.2.1/src/libmain/api_base.c:757:1: enter_function: entry to 'ddci_init'
ddcutil-2.2.1/src/libmain/api_base.c:770:7: branch_true: following 'true' branch (when 'infomsg_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_base.c:771:7: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_base.c:780:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_base.c:786:27: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_base.c:787:4: branch_false: following 'false' branch (when 'debug == 0')...
ddcutil-2.2.1/src/libmain/api_base.c:789:7: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_base.c:819:22: call_function: calling 'get_parsed_libmain_config' from 'ddci_init'
#  410|      if (disable_config_file) {
#  411|         DBGF(debug, "config file disabled");
#  412|->       new_argv = ntsa_copy(cmd_name_array, true);
#  413|         new_argc = ntsa_length(cmd_name_array);
#  414|         ntsa_free(cmd_name_array, true);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def502]
ddcutil-2.2.1/src/libmain/api_base.c:417:29: warning[-Wanalyzer-malloc-leak]: leak of 'cmd_name_array'
ddcutil-2.2.1/src/libmain/api_base.c:757:1: enter_function: entry to 'ddci_init'
ddcutil-2.2.1/src/libmain/api_base.c:770:7: branch_true: following 'true' branch (when 'infomsg_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_base.c:771:7: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_base.c:780:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_base.c:786:27: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_base.c:787:4: branch_false: following 'false' branch (when 'debug == 0')...
ddcutil-2.2.1/src/libmain/api_base.c:789:7: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_base.c:819:22: call_function: calling 'get_parsed_libmain_config' from 'ddci_init'
#  415|      }
#  416|      else {
#  417|->       GPtrArray * errmsgs = g_ptr_array_new_with_free_func(g_free);
#  418|         char *  config_fn = NULL;
#  419|         DBGF(debug, "Calling apply_config_file()...");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def503]
ddcutil-2.2.1/src/libmain/api_base.c:420:29: warning[-Wanalyzer-malloc-leak]: leak of 'cmd_name_array'
ddcutil-2.2.1/src/libmain/api_base.c:757:1: enter_function: entry to 'ddci_init'
ddcutil-2.2.1/src/libmain/api_base.c:770:7: branch_true: following 'true' branch (when 'infomsg_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_base.c:771:7: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_base.c:780:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_base.c:786:27: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_base.c:787:4: branch_false: following 'false' branch (when 'debug == 0')...
ddcutil-2.2.1/src/libmain/api_base.c:789:7: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_base.c:819:22: call_function: calling 'get_parsed_libmain_config' from 'ddci_init'
#  418|         char *  config_fn = NULL;
#  419|         DBGF(debug, "Calling apply_config_file()...");
#  420|->       int apply_config_rc = apply_config_file(
#  421|                                       "libddcutil",  // use this section of config file
#  422|                                       ntsa_length(cmd_name_array), cmd_name_array,

Error: CPPCHECK_WARNING (CWE-476): [#def504]
ddcutil-2.2.1/src/libmain/api_capabilities.c:161: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  159|         }
#  160|         result = calloc(1, sizeof(DDCA_Capabilities));
#  161|->       memcpy(result->marker, DDCA_CAPABILITIES_MARKER, 4);
#  162|         result->unparsed_string = g_strdup(capabilities_string);     // needed?
#  163|         result->version_spec = pcaps->parsed_mccs_version;

Error: CPPCHECK_WARNING (CWE-476): [#def505]
ddcutil-2.2.1/src/libmain/api_capabilities.c:162: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  160|         result = calloc(1, sizeof(DDCA_Capabilities));
#  161|         memcpy(result->marker, DDCA_CAPABILITIES_MARKER, 4);
#  162|->       result->unparsed_string = g_strdup(capabilities_string);     // needed?
#  163|         result->version_spec = pcaps->parsed_mccs_version;
#  164|         DBGMSF(debug, "version: %d.%d", result->version_spec.major,  result->version_spec.minor);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def506]
ddcutil-2.2.1/src/libmain/api_capabilities.c:162:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/libmain/api_capabilities.c:140:1: enter_function: entry to 'ddca_parse_capabilities_string'
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:148:4: branch_false: following 'false' branch (when 'parsed_capabilities_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:153:34: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:154:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/libmain/api_capabilities.c:162:7: danger: 'result' could be NULL: unchecked value from [(8)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/7)
#  160|         result = calloc(1, sizeof(DDCA_Capabilities));
#  161|         memcpy(result->marker, DDCA_CAPABILITIES_MARKER, 4);
#  162|->       result->unparsed_string = g_strdup(capabilities_string);     // needed?
#  163|         result->version_spec = pcaps->parsed_mccs_version;
#  164|         DBGMSF(debug, "version: %d.%d", result->version_spec.major,  result->version_spec.minor);

Error: CPPCHECK_WARNING (CWE-476): [#def507]
ddcutil-2.2.1/src/libmain/api_capabilities.c:163: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  161|         memcpy(result->marker, DDCA_CAPABILITIES_MARKER, 4);
#  162|         result->unparsed_string = g_strdup(capabilities_string);     // needed?
#  163|->       result->version_spec = pcaps->parsed_mccs_version;
#  164|         DBGMSF(debug, "version: %d.%d", result->version_spec.major,  result->version_spec.minor);
#  165|         Byte_Value_Array bva = pcaps->commands;

Error: CPPCHECK_WARNING (CWE-476): [#def508]
ddcutil-2.2.1/src/libmain/api_capabilities.c:164: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  162|         result->unparsed_string = g_strdup(capabilities_string);     // needed?
#  163|         result->version_spec = pcaps->parsed_mccs_version;
#  164|->       DBGMSF(debug, "version: %d.%d", result->version_spec.major,  result->version_spec.minor);
#  165|         Byte_Value_Array bva = pcaps->commands;
#  166|         if (bva) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def509]
ddcutil-2.2.1/src/libmain/api_capabilities.c:167:27: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/libmain/api_capabilities.c:140:1: enter_function: entry to 'ddca_parse_capabilities_string'
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:148:4: branch_false: following 'false' branch (when 'parsed_capabilities_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:153:34: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:154:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_capabilities.c:166:10: branch_true: following 'true' branch (when 'bva' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:167:27: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:167:27: danger: 'result' leaks here; was allocated at [(8)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/7)
#  165|         Byte_Value_Array bva = pcaps->commands;
#  166|         if (bva) {
#  167|->          result->cmd_ct = bva_length(bva);
#  168|            result->cmd_codes = malloc(result->cmd_ct);
#  169|            memcpy(result->cmd_codes, bva_bytes(bva), result->cmd_ct);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def510]
ddcutil-2.2.1/src/libmain/api_capabilities.c:169:36: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/libmain/api_capabilities.c:140:1: enter_function: entry to 'ddca_parse_capabilities_string'
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:148:4: branch_false: following 'false' branch (when 'parsed_capabilities_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:153:34: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:154:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:166:10: branch_true: following 'true' branch (when 'bva' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:167:27: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:168:30: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_capabilities.c:169:36: danger: '<unknown>' leaks here; was allocated at [(13)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/12)
#  167|            result->cmd_ct = bva_length(bva);
#  168|            result->cmd_codes = malloc(result->cmd_ct);
#  169|->          memcpy(result->cmd_codes, bva_bytes(bva), result->cmd_ct);
#  170|         }
#  171|         // n. needen't set vcp_code_ct if !pcaps, calloc() has done it

Error: GCC_ANALYZER_WARNING (CWE-401): [#def511]
ddcutil-2.2.1/src/libmain/api_capabilities.c:169:36: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/libmain/api_capabilities.c:140:1: enter_function: entry to 'ddca_parse_capabilities_string'
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:148:4: branch_false: following 'false' branch (when 'parsed_capabilities_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:153:34: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:154:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_capabilities.c:166:10: branch_true: following 'true' branch (when 'bva' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:167:27: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:169:36: danger: 'result' leaks here; was allocated at [(8)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/7)
#  167|            result->cmd_ct = bva_length(bva);
#  168|            result->cmd_codes = malloc(result->cmd_ct);
#  169|->          memcpy(result->cmd_codes, bva_bytes(bva), result->cmd_ct);
#  170|         }
#  171|         // n. needen't set vcp_code_ct if !pcaps, calloc() has done it

Error: GCC_ANALYZER_WARNING (CWE-476): [#def512]
ddcutil-2.2.1/src/libmain/api_capabilities.c:186:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_cap_vcp'
ddcutil-2.2.1/src/libmain/api_capabilities.c:140:1: enter_function: entry to 'ddca_parse_capabilities_string'
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:148:4: branch_false: following 'false' branch (when 'parsed_capabilities_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:153:34: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:154:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:166:10: branch_false: following 'false' branch (when 'bva' is NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:11: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:173:32: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:174:30: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/libmain/api_capabilities.c:176:28: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:177:43: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:182:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:186:41: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:186:13: danger: 'cur_cap_vcp' could be NULL: unchecked value from [(15)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/14)
#  184|                  dbgrpt_capabilities_feature_record(cur_cfr, 2);
#  185|               //    show_capabilities_feature(cur_cfr, result->version_spec);
#  186|->             cur_cap_vcp->feature_code = cur_cfr->feature_id;
#  187|               DBGMSF(debug, "cur_cfr = %p, feature_code - 0x%02x", cur_cfr, cur_cfr->feature_id);
#  188|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def513]
ddcutil-2.2.1/src/libmain/api_capabilities.c:194:40: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:148:4: branch_false: following 'false' branch (when 'parsed_capabilities_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:153:34: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:154:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:166:10: branch_true: following 'true' branch (when 'bva' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:167:27: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:168:30: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:173:32: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:176:28: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:177:43: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:182:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:186:41: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:193:16: branch_true: following 'true' branch (when 'bva' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:194:40: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:194:40: danger: '<unknown>' leaks here; was allocated at [(9)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/8)
#  192|               Byte_Value_Array bva = cur_cfr->values;
#  193|               if (bva) {
#  194|->                cur_cap_vcp->value_ct = bva_length(bva);
#  195|                  cur_cap_vcp->values = calloc( cur_cap_vcp->value_ct, sizeof(Byte));
#  196|                  memcpy(cur_cap_vcp->values, bva_bytes(bva), cur_cap_vcp->value_ct);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def514]
ddcutil-2.2.1/src/libmain/api_capabilities.c:194:40: warning[-Wanalyzer-malloc-leak]: leak of 'cur_cap_vcp'
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:148:4: branch_false: following 'false' branch (when 'parsed_capabilities_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:153:34: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:154:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:166:10: branch_false: following 'false' branch (when 'bva' is NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:11: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:173:32: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:174:30: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_capabilities.c:176:28: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:177:43: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:182:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:186:41: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:193:16: branch_true: following 'true' branch (when 'bva' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:194:40: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:194:40: danger: 'cur_cap_vcp' leaks here; was allocated at [(11)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/10)
#  192|               Byte_Value_Array bva = cur_cfr->values;
#  193|               if (bva) {
#  194|->                cur_cap_vcp->value_ct = bva_length(bva);
#  195|                  cur_cap_vcp->values = calloc( cur_cap_vcp->value_ct, sizeof(Byte));
#  196|                  memcpy(cur_cap_vcp->values, bva_bytes(bva), cur_cap_vcp->value_ct);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def515]
ddcutil-2.2.1/src/libmain/api_capabilities.c:194:40: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:148:4: branch_false: following 'false' branch (when 'parsed_capabilities_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:153:34: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:154:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_capabilities.c:166:10: branch_false: following 'false' branch (when 'bva' is NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:11: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:173:32: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:176:28: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:177:43: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:182:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:186:41: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:193:16: branch_true: following 'true' branch (when 'bva' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:194:40: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:194:40: danger: 'result' leaks here; was allocated at [(7)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/6)
#  192|               Byte_Value_Array bva = cur_cfr->values;
#  193|               if (bva) {
#  194|->                cur_cap_vcp->value_ct = bva_length(bva);
#  195|                  cur_cap_vcp->values = calloc( cur_cap_vcp->value_ct, sizeof(Byte));
#  196|                  memcpy(cur_cap_vcp->values, bva_bytes(bva), cur_cap_vcp->value_ct);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def516]
ddcutil-2.2.1/src/libmain/api_capabilities.c:196:44: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:148:4: branch_false: following 'false' branch (when 'parsed_capabilities_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:153:34: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:154:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:166:10: branch_false: following 'false' branch (when 'bva' is NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:11: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:173:32: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:176:28: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:177:43: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:182:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:186:41: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:193:16: branch_true: following 'true' branch (when 'bva' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:194:40: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:195:38: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_capabilities.c:196:44: danger: '<unknown>' leaks here; was allocated at [(17)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/16)
#  194|                  cur_cap_vcp->value_ct = bva_length(bva);
#  195|                  cur_cap_vcp->values = calloc( cur_cap_vcp->value_ct, sizeof(Byte));
#  196|->                memcpy(cur_cap_vcp->values, bva_bytes(bva), cur_cap_vcp->value_ct);
#  197|               }
#  198|   #endif

Error: GCC_ANALYZER_WARNING (CWE-401): [#def517]
ddcutil-2.2.1/src/libmain/api_capabilities.c:196:44: warning[-Wanalyzer-malloc-leak]: leak of 'cur_cap_vcp'
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:148:4: branch_false: following 'false' branch (when 'parsed_capabilities_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:153:34: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:154:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:166:10: branch_false: following 'false' branch (when 'bva' is NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:11: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:173:32: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:174:30: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_capabilities.c:176:28: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:177:43: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:182:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:186:41: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:193:16: branch_true: following 'true' branch (when 'bva' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:194:40: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:196:44: danger: 'cur_cap_vcp' leaks here; was allocated at [(11)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/10)
#  194|                  cur_cap_vcp->value_ct = bva_length(bva);
#  195|                  cur_cap_vcp->values = calloc( cur_cap_vcp->value_ct, sizeof(Byte));
#  196|->                memcpy(cur_cap_vcp->values, bva_bytes(bva), cur_cap_vcp->value_ct);
#  197|               }
#  198|   #endif

Error: GCC_ANALYZER_WARNING (CWE-401): [#def518]
ddcutil-2.2.1/src/libmain/api_capabilities.c:196:44: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:148:4: branch_false: following 'false' branch (when 'parsed_capabilities_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:153:34: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:154:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_capabilities.c:166:10: branch_false: following 'false' branch (when 'bva' is NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:11: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:173:32: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:176:28: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:177:43: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:182:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:186:41: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:193:16: branch_true: following 'true' branch (when 'bva' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:194:40: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:196:44: danger: 'result' leaks here; was allocated at [(7)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/6)
#  194|                  cur_cap_vcp->value_ct = bva_length(bva);
#  195|                  cur_cap_vcp->values = calloc( cur_cap_vcp->value_ct, sizeof(Byte));
#  196|->                memcpy(cur_cap_vcp->values, bva_bytes(bva), cur_cap_vcp->value_ct);
#  197|               }
#  198|   #endif

Error: GCC_ANALYZER_WARNING (CWE-401): [#def519]
ddcutil-2.2.1/src/libmain/api_capabilities.c:216:29: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:148:4: branch_false: following 'false' branch (when 'parsed_capabilities_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:153:34: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:154:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:166:10: branch_true: following 'true' branch (when 'bva' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:167:27: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:168:30: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:214:11: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:214:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:216:29: danger: '<unknown>' leaks here; was allocated at [(9)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/8)
#  214|         if (pcaps->messages && pcaps->messages->len > 0) {
#  215|            result->msg_ct = pcaps->messages->len;
#  216|->          result->messages = g_ptr_array_to_ntsa(pcaps->messages, /*duplicate=*/ true);
#  217|         }
#  218|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def520]
ddcutil-2.2.1/src/libmain/api_capabilities.c:216:29: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:148:4: branch_false: following 'false' branch (when 'parsed_capabilities_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:153:34: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:154:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_capabilities.c:166:10: branch_false: following 'false' branch (when 'bva' is NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:11: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:214:11: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:214:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:216:29: danger: 'result' leaks here; was allocated at [(7)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/6)
#  214|         if (pcaps->messages && pcaps->messages->len > 0) {
#  215|            result->msg_ct = pcaps->messages->len;
#  216|->          result->messages = g_ptr_array_to_ntsa(pcaps->messages, /*duplicate=*/ true);
#  217|         }
#  218|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def521]
ddcutil-2.2.1/src/libmain/api_capabilities.c:220:7: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:148:4: branch_false: following 'false' branch (when 'parsed_capabilities_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:153:34: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:154:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:166:10: branch_true: following 'true' branch (when 'bva' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:167:27: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:168:30: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:214:11: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:220:7: danger: '<unknown>' leaks here; was allocated at [(9)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/8)
#  218|   
#  219|         ddcrc = 0;
#  220|->       free_parsed_capabilities(pcaps);
#  221|      }
#  222|      *parsed_capabilities_loc = result;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def522]
ddcutil-2.2.1/src/libmain/api_capabilities.c:220:7: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:146:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:148:4: branch_false: following 'false' branch (when 'parsed_capabilities_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:153:34: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:154:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:160:16: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_capabilities.c:166:10: branch_false: following 'false' branch (when 'bva' is NULL)...
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:11: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:172:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_capabilities.c:214:11: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_capabilities.c:220:7: danger: 'result' leaks here; was allocated at [(7)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/6)
#  218|   
#  219|         ddcrc = 0;
#  220|->       free_parsed_capabilities(pcaps);
#  221|      }
#  222|      *parsed_capabilities_loc = result;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def523]
ddcutil-2.2.1/src/libmain/api_displays.c:901:4: warning[-Wanalyzer-malloc-leak]: leak of 'result_list'
ddcutil-2.2.1/src/libmain/api_displays.c:1146:1: enter_function: entry to 'ddca_get_display_info_list2'
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1155:4: branch_false: following 'false' branch (when 'dlist_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1158:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1166:43: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1175:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1176:28: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1180:7: call_function: calling 'ddci_init_display_info' from 'ddca_get_display_info_list2'
#  899|    void ddci_init_display_info(Display_Ref * dref, DDCA_Display_Info * curinfo) {
#  900|      bool debug = false;
#  901|->    DBGTRC_STARTING(debug, DDCA_TRC_API, "dref=%s, curinfo=%p", dref_reprx_t(dref),curinfo);
#  902|      memcpy(curinfo->marker, DDCA_DISPLAY_INFO_MARKER, 4);
#  903|      curinfo->dispno        = dref->dispno;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def524]
ddcutil-2.2.1/src/libmain/api_displays.c:1062:23: warning[-Wanalyzer-malloc-leak]: leak of 'result_list'
ddcutil-2.2.1/src/libmain/api_displays.c:1146:1: enter_function: entry to 'ddca_get_display_info_list2'
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1155:4: branch_false: following 'false' branch (when 'dlist_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1158:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1166:43: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1175:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1184:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1186:8: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1192:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1192:4: call_function: calling 'set_ddca_error_detail_from_open_errors' from 'ddca_get_display_info_list2'
# 1060|   set_ddca_error_detail_from_open_errors() {
# 1061|      bool debug = false;
# 1062|->    GPtrArray * errs = ddc_get_bus_open_errors();
# 1063|      // DDCA_Status master_rc = 0;
# 1064|      if (errs && errs->len > 0) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def525]
ddcutil-2.2.1/src/libmain/api_displays.c:1065:35: warning[-Wanalyzer-malloc-leak]: leak of 'result_list'
ddcutil-2.2.1/src/libmain/api_displays.c:1146:1: enter_function: entry to 'ddca_get_display_info_list2'
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1155:4: branch_false: following 'false' branch (when 'dlist_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1158:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1166:43: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1175:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1184:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1186:8: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1192:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1192:4: call_function: calling 'set_ddca_error_detail_from_open_errors' from 'ddca_get_display_info_list2'
# 1063|      // DDCA_Status master_rc = 0;
# 1064|      if (errs && errs->len > 0) {
# 1065|->       Error_Info * master_error = ERRINFO_NEW(DDCRC_OTHER, "Error(s) opening ddc devices");
# 1066|         MSG_W_SYSLOG(DDCA_SYSLOG_ERROR, "Error(s) opening ddc devices");
# 1067|         for (int ndx = 0; ndx < errs->len; ndx++) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def526]
ddcutil-2.2.1/src/libmain/api_displays.c:1066:7: warning[-Wanalyzer-malloc-leak]: leak of 'result_list'
ddcutil-2.2.1/src/libmain/api_displays.c:1146:1: enter_function: entry to 'ddca_get_display_info_list2'
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1155:4: branch_false: following 'false' branch (when 'dlist_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1158:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1166:43: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1175:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1184:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1186:8: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1192:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1192:4: call_function: calling 'set_ddca_error_detail_from_open_errors' from 'ddca_get_display_info_list2'
# 1064|      if (errs && errs->len > 0) {
# 1065|         Error_Info * master_error = ERRINFO_NEW(DDCRC_OTHER, "Error(s) opening ddc devices");
# 1066|->       MSG_W_SYSLOG(DDCA_SYSLOG_ERROR, "Error(s) opening ddc devices");
# 1067|         for (int ndx = 0; ndx < errs->len; ndx++) {
# 1068|            Bus_Open_Error * cur = g_ptr_array_index(errs, ndx);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def527]
ddcutil-2.2.1/src/libmain/api_displays.c:1071:23: warning[-Wanalyzer-malloc-leak]: leak of 'result_list'
ddcutil-2.2.1/src/libmain/api_displays.c:1146:1: enter_function: entry to 'ddca_get_display_info_list2'
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1155:4: branch_false: following 'false' branch (when 'dlist_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1158:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1166:43: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1175:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1184:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1186:8: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1192:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1192:4: call_function: calling 'set_ddca_error_detail_from_open_errors' from 'ddca_get_display_info_list2'
# 1069|            Error_Info * errinfo = NULL;
# 1070|            if (cur->io_mode == DDCA_IO_I2C) {
# 1071|->             errinfo = ERRINFO_NEW(cur->error, "Error %s opening /dev/i2c-%d",
# 1072|                                                psc_desc(cur->error), cur->devno);
# 1073|               MSG_W_SYSLOG(DDCA_SYSLOG_ERROR, "Error %s opening /dev/i2c-%d",

Error: GCC_ANALYZER_WARNING (CWE-476): [#def528]
ddcutil-2.2.1/src/libmain/api_displays.c:1113:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_ddca_dref'
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1101:4: branch_false: following 'false' branch (when 'drefs_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1105:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1109:37: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/libmain/api_displays.c:1111:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1112:31: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1113:10: danger: 'cur_ddca_dref' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/6)
# 1111|      for (int ndx = 0; ndx < filtered_displays->len; ndx++) {
# 1112|            Display_Ref * dref = g_ptr_array_index(filtered_displays, ndx);
# 1113|->          *cur_ddca_dref = dref_to_ddca_dref(dref);
# 1114|            // DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "%p -> %p", cur_ddca_dref, *cur_ddca_dref);
# 1115|            add_published_dref_id_by_dref(dref);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def529]
ddcutil-2.2.1/src/libmain/api_displays.c:1113:27: warning[-Wanalyzer-malloc-leak]: leak of 'cur_ddca_dref'
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1101:4: branch_false: following 'false' branch (when 'drefs_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1105:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1109:37: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1111:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1112:31: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1113:27: danger: 'cur_ddca_dref' leaks here; was allocated at [(7)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/6)
# 1111|      for (int ndx = 0; ndx < filtered_displays->len; ndx++) {
# 1112|            Display_Ref * dref = g_ptr_array_index(filtered_displays, ndx);
# 1113|->          *cur_ddca_dref = dref_to_ddca_dref(dref);
# 1114|            // DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "%p -> %p", cur_ddca_dref, *cur_ddca_dref);
# 1115|            add_published_dref_id_by_dref(dref);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def530]
ddcutil-2.2.1/src/libmain/api_displays.c:1113:27: warning[-Wanalyzer-malloc-leak]: leak of 'result_list'
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1101:4: branch_false: following 'false' branch (when 'drefs_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1105:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1109:37: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1111:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1112:31: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1111:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1112:31: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1113:27: danger: 'result_list' leaks here; was allocated at [(7)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/6)
# 1111|      for (int ndx = 0; ndx < filtered_displays->len; ndx++) {
# 1112|            Display_Ref * dref = g_ptr_array_index(filtered_displays, ndx);
# 1113|->          *cur_ddca_dref = dref_to_ddca_dref(dref);
# 1114|            // DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "%p -> %p", cur_ddca_dref, *cur_ddca_dref);
# 1115|            add_published_dref_id_by_dref(dref);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def531]
ddcutil-2.2.1/src/libmain/api_displays.c:1115:10: warning[-Wanalyzer-malloc-leak]: leak of 'cur_ddca_dref'
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1101:4: branch_false: following 'false' branch (when 'drefs_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1105:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1109:37: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1111:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1112:31: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1115:10: danger: 'cur_ddca_dref' leaks here; was allocated at [(7)](sarif:/runs/0/results/15/codeFlows/0/threadFlows/0/locations/6)
# 1113|            *cur_ddca_dref = dref_to_ddca_dref(dref);
# 1114|            // DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "%p -> %p", cur_ddca_dref, *cur_ddca_dref);
# 1115|->          add_published_dref_id_by_dref(dref);
# 1116|            cur_ddca_dref++;
# 1117|      }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def532]
ddcutil-2.2.1/src/libmain/api_displays.c:1115:10: warning[-Wanalyzer-malloc-leak]: leak of 'result_list'
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1101:4: branch_false: following 'false' branch (when 'drefs_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1105:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1109:37: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1111:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1112:31: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1111:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1112:31: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1115:10: danger: 'result_list' leaks here; was allocated at [(7)](sarif:/runs/0/results/16/codeFlows/0/threadFlows/0/locations/6)
# 1113|            *cur_ddca_dref = dref_to_ddca_dref(dref);
# 1114|            // DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "%p -> %p", cur_ddca_dref, *cur_ddca_dref);
# 1115|->          add_published_dref_id_by_dref(dref);
# 1116|            cur_ddca_dref++;
# 1117|      }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def533]
ddcutil-2.2.1/src/libmain/api_displays.c:1118:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_ddca_dref'
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1101:4: branch_false: following 'false' branch (when 'drefs_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1105:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1109:37: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/libmain/api_displays.c:1111:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1118:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1118:4: danger: 'cur_ddca_dref' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/6)
# 1116|            cur_ddca_dref++;
# 1117|      }
# 1118|->    *cur_ddca_dref = NULL; // terminating NULL ptr, redundant since calloc()
# 1119|      dref_ct = filtered_displays->len;
# 1120|      g_ptr_array_free(filtered_displays, true);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def534]
ddcutil-2.2.1/src/libmain/api_displays.c:1120:4: warning[-Wanalyzer-malloc-leak]: leak of 'cur_ddca_dref'
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1101:4: branch_false: following 'false' branch (when 'drefs_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1105:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1109:37: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1111:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1118:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1120:4: danger: 'cur_ddca_dref' leaks here; was allocated at [(7)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/6)
# 1118|      *cur_ddca_dref = NULL; // terminating NULL ptr, redundant since calloc()
# 1119|      dref_ct = filtered_displays->len;
# 1120|->    g_ptr_array_free(filtered_displays, true);
# 1121|   
# 1122|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def535]
ddcutil-2.2.1/src/libmain/api_displays.c:1123:8: warning[-Wanalyzer-malloc-leak]: leak of 'cur_ddca_dref'
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1101:4: branch_false: following 'false' branch (when 'drefs_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1105:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1109:37: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1111:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1118:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1123:8: danger: 'cur_ddca_dref' leaks here; was allocated at [(7)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/6)
# 1121|   
# 1122|   
# 1123|->    if (IS_DBGTRC(debug, DDCA_TRC_API|DDCA_TRC_DDC )) {
# 1124|         DBGMSG("          *drefs_loc=%p", drefs_loc);
# 1125|         DDCA_Display_Ref * cur_ddca_dref = result_list;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def536]
ddcutil-2.2.1/src/libmain/api_displays.c:1124:7: warning[-Wanalyzer-malloc-leak]: leak of 'cur_ddca_dref'
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1101:4: branch_false: following 'false' branch (when 'drefs_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1105:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1109:37: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1111:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1118:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1123:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1124:7: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1124:7: danger: 'cur_ddca_dref' leaks here; was allocated at [(7)](sarif:/runs/0/results/20/codeFlows/0/threadFlows/0/locations/6)
# 1122|   
# 1123|      if (IS_DBGTRC(debug, DDCA_TRC_API|DDCA_TRC_DDC )) {
# 1124|->       DBGMSG("          *drefs_loc=%p", drefs_loc);
# 1125|         DDCA_Display_Ref * cur_ddca_dref = result_list;
# 1126|         while (*cur_ddca_dref) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def537]
ddcutil-2.2.1/src/libmain/api_displays.c:1131:7: warning[-Wanalyzer-malloc-leak]: leak of 'cur_ddca_dref'
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1100:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1101:4: branch_false: following 'false' branch (when 'drefs_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1105:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1109:37: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1111:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1118:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1123:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1124:7: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1126:14: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1131:7: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1131:7: danger: 'cur_ddca_dref' leaks here; was allocated at [(7)](sarif:/runs/0/results/21/codeFlows/0/threadFlows/0/locations/6)
# 1129|            cur_ddca_dref++;
# 1130|         }
# 1131|->       dbgrpt_published_dref_hash(__func__, 1);
# 1132|      }
# 1133|   

Error: CPPCHECK_WARNING (CWE-476): [#def538]
ddcutil-2.2.1/src/libmain/api_displays.c:1167: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result_list
# 1165|      DBGMSF(debug, "reqd_size=%d", reqd_size);
# 1166|      DDCA_Display_Info_List * result_list = calloc(1,reqd_size);
# 1167|->    result_list->ct = filtered_ct;
# 1168|      DBGMSF(debug, "sizeof(DDCA_Display_Info) = %zu,"
# 1169|                    " sizeof(Display_Info_List) = %zu, reqd_size=%d, filtered_ct=%d, offsetof(DDCA_Display_Info_List,info) = %zu",

Error: GCC_ANALYZER_WARNING (CWE-476): [#def539]
ddcutil-2.2.1/src/libmain/api_displays.c:1167:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result_list'
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1155:4: branch_false: following 'false' branch (when 'dlist_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1158:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1166:43: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/libmain/api_displays.c:1167:4: danger: 'result_list' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/22/codeFlows/0/threadFlows/0/locations/6)
# 1165|      DBGMSF(debug, "reqd_size=%d", reqd_size);
# 1166|      DDCA_Display_Info_List * result_list = calloc(1,reqd_size);
# 1167|->    result_list->ct = filtered_ct;
# 1168|      DBGMSF(debug, "sizeof(DDCA_Display_Info) = %zu,"
# 1169|                    " sizeof(Display_Info_List) = %zu, reqd_size=%d, filtered_ct=%d, offsetof(DDCA_Display_Info_List,info) = %zu",

Error: GCC_ANALYZER_WARNING (CWE-401): [#def540]
ddcutil-2.2.1/src/libmain/api_displays.c:1184:4: warning[-Wanalyzer-malloc-leak]: leak of 'result_list'
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1155:4: branch_false: following 'false' branch (when 'dlist_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1158:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1166:43: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1175:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1184:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1184:4: danger: 'result_list' leaks here; was allocated at [(7)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/6)
# 1182|         curinfo++;
# 1183|      }
# 1184|->    g_ptr_array_free(filtered_displays, true);
# 1185|   
# 1186|      if (IS_DBGTRC(debug, DDCA_TRC_API|DDCA_TRC_DDC )) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def541]
ddcutil-2.2.1/src/libmain/api_displays.c:1186:8: warning[-Wanalyzer-malloc-leak]: leak of 'result_list'
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1155:4: branch_false: following 'false' branch (when 'dlist_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1158:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1166:43: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1175:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1184:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1186:8: danger: 'result_list' leaks here; was allocated at [(7)](sarif:/runs/0/results/24/codeFlows/0/threadFlows/0/locations/6)
# 1184|      g_ptr_array_free(filtered_displays, true);
# 1185|   
# 1186|->    if (IS_DBGTRC(debug, DDCA_TRC_API|DDCA_TRC_DDC )) {
# 1187|         DBGMSG("Final result list %p", result_list);
# 1188|         dbgrpt_display_info_list(result_list, 2);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def542]
ddcutil-2.2.1/src/libmain/api_displays.c:1187:7: warning[-Wanalyzer-malloc-leak]: leak of 'result_list'
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1152:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1155:4: branch_false: following 'false' branch (when 'dlist_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_displays.c:1158:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1166:43: acquire_memory: allocated here
ddcutil-2.2.1/src/libmain/api_displays.c:1175:22: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1184:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1186:8: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_displays.c:1187:7: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_displays.c:1187:7: danger: 'result_list' leaks here; was allocated at [(7)](sarif:/runs/0/results/25/codeFlows/0/threadFlows/0/locations/6)
# 1185|   
# 1186|      if (IS_DBGTRC(debug, DDCA_TRC_API|DDCA_TRC_DDC )) {
# 1187|->       DBGMSG("Final result list %p", result_list);
# 1188|         dbgrpt_display_info_list(result_list, 2);
# 1189|         dbgrpt_published_dref_hash(__func__, 1);

Error: CPPCHECK_WARNING (CWE-476): [#def543]
ddcutil-2.2.1/src/libmain/api_error_info_internal.c:55: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: errdet
#   53|   DDCA_Error_Detail * new_ddca_error_detail(DDCA_Status ddcrc, const char * format, ...) {
#   54|      DDCA_Error_Detail * errdet = calloc(1, sizeof(DDCA_Error_Detail));
#   55|->    memcpy(errdet->marker, DDCA_ERROR_DETAIL_MARKER, 4);
#   56|      errdet->status_code = ddcrc;
#   57|      va_list(args);

Error: CPPCHECK_WARNING (CWE-476): [#def544]
ddcutil-2.2.1/src/libmain/api_error_info_internal.c:56: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: errdet
#   54|      DDCA_Error_Detail * errdet = calloc(1, sizeof(DDCA_Error_Detail));
#   55|      memcpy(errdet->marker, DDCA_ERROR_DETAIL_MARKER, 4);
#   56|->    errdet->status_code = ddcrc;
#   57|      va_list(args);
#   58|      va_start(args, format);

Error: CPPCHECK_WARNING (CWE-476): [#def545]
ddcutil-2.2.1/src/libmain/api_error_info_internal.c:61: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: errdet
#   59|      // if (debug)
#   60|      //    printf("(%s) &args=%p, args=%p\n", __func__, &args, args);
#   61|->    errdet->detail = g_strdup_vprintf(format, args);
#   62|      va_end(args);
#   63|      return errdet;

Error: CPPCHECK_WARNING (CWE-476): [#def546]
ddcutil-2.2.1/src/libmain/api_error_info_internal.c:85: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#   83|         int reqd_size = sizeof(DDCA_Error_Detail) + erec->cause_ct * sizeof(DDCA_Error_Detail*);
#   84|         result = calloc(1, reqd_size);
#   85|->       memcpy(result->marker, DDCA_ERROR_DETAIL_MARKER, 4);
#   86|         result->status_code = erec->status_code;
#   87|         if (erec->detail)

Error: CPPCHECK_WARNING (CWE-476): [#def547]
ddcutil-2.2.1/src/libmain/api_error_info_internal.c:86: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#   84|         result = calloc(1, reqd_size);
#   85|         memcpy(result->marker, DDCA_ERROR_DETAIL_MARKER, 4);
#   86|->       result->status_code = erec->status_code;
#   87|         if (erec->detail)
#   88|            result->detail = strdup(erec->detail);

Error: CPPCHECK_WARNING (CWE-476): [#def548]
ddcutil-2.2.1/src/libmain/api_error_info_internal.c:91: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#   89|         for (int ndx = 0; ndx < erec->cause_ct; ndx++) {
#   90|            DDCA_Error_Detail * cause = error_info_to_ddca_detail(erec->causes[ndx]);
#   91|->          result->causes[ndx] = cause;
#   92|         }
#   93|         result->cause_ct = erec->cause_ct;

Error: CPPCHECK_WARNING (CWE-476): [#def549]
ddcutil-2.2.1/src/libmain/api_error_info_internal.c:93: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#   91|            result->causes[ndx] = cause;
#   92|         }
#   93|->       result->cause_ct = erec->cause_ct;
#   94|      }
#   95|   

Error: CPPCHECK_WARNING (CWE-476): [#def550]
ddcutil-2.2.1/src/libmain/api_error_info_internal.c:120: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  118|         int reqd_size = sizeof(DDCA_Error_Detail) + old->cause_ct * sizeof(DDCA_Error_Detail*);
#  119|         result = calloc(1, reqd_size);
#  120|->       memcpy(result->marker, DDCA_ERROR_DETAIL_MARKER, 4);
#  121|         result->status_code = old->status_code;
#  122|         if (old->detail)

Error: CPPCHECK_WARNING (CWE-476): [#def551]
ddcutil-2.2.1/src/libmain/api_error_info_internal.c:121: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  119|         result = calloc(1, reqd_size);
#  120|         memcpy(result->marker, DDCA_ERROR_DETAIL_MARKER, 4);
#  121|->       result->status_code = old->status_code;
#  122|         if (old->detail)
#  123|            result->detail = g_strdup(old->detail);

Error: CPPCHECK_WARNING (CWE-476): [#def552]
ddcutil-2.2.1/src/libmain/api_error_info_internal.c:126: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  124|         for (int ndx = 0; ndx < old->cause_ct; ndx++) {
#  125|            DDCA_Error_Detail * cause = dup_error_detail(old->causes[ndx]);
#  126|->          result->causes[ndx] = cause;
#  127|         }
#  128|         result->cause_ct = old->cause_ct;

Error: CPPCHECK_WARNING (CWE-476): [#def553]
ddcutil-2.2.1/src/libmain/api_error_info_internal.c:128: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  126|            result->causes[ndx] = cause;
#  127|         }
#  128|->       result->cause_ct = old->cause_ct;
#  129|      }
#  130|   

Error: CPPCHECK_WARNING (CWE-476): [#def554]
ddcutil-2.2.1/src/libmain/api_feature_access.c:152: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: tv
#  150|         goto bye;
#  151|   
#  152|->    WITH_VALIDATED_DH3(ddca_dh, psc,
#  153|         {
#  154|            assert(table_value_loc);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def555]
ddcutil-2.2.1/src/libmain/api_feature_access.c:152:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'tv'
ddcutil-2.2.1/src/libmain/api_feature_access.c:145:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_feature_access.c:145:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_feature_access.c:145:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_feature_access.c:145:4: branch_true: ...to here
ddcutil-2.2.1/src/libmain/api_feature_access.c:148:22: branch_false: following 'false' branch (when 'table_value_loc' is non-NULL)...
ddcutil-2.2.1/src/libmain/api_feature_access.c:152:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_feature_access.c:152:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/libmain/api_feature_access.c:152:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/libmain/api_feature_access.c:152:4: branch_false: ...to here
ddcutil-2.2.1/src/libmain/api_feature_access.c:152:4: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/libmain/api_feature_access.c:152:4: danger: 'tv' could be NULL: unchecked value from [(11)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/10)
#  150|         goto bye;
#  151|   
#  152|->    WITH_VALIDATED_DH3(ddca_dh, psc,
#  153|         {
#  154|            assert(table_value_loc);

Error: CPPCHECK_WARNING (CWE-476): [#def556]
ddcutil-2.2.1/src/libmain/api_feature_access.c:1044: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: verified_table_value
# 1042|          if (verified_single_value) {
# 1043|             DDCA_Table_Vcp_Value * verified_table_value = calloc(1,sizeof(DDCA_Table_Vcp_Value));
# 1044|->           verified_table_value->bytect = verified_single_value->val.t.bytect;
# 1045|             verified_table_value->bytes  = verified_single_value->val.t.bytes;
# 1046|             free(verified_single_value);  // n. does not free bytes

Error: CPPCHECK_WARNING (CWE-476): [#def557]
ddcutil-2.2.1/src/libmain/api_feature_access.c:1045: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: verified_table_value
# 1043|             DDCA_Table_Vcp_Value * verified_table_value = calloc(1,sizeof(DDCA_Table_Vcp_Value));
# 1044|             verified_table_value->bytect = verified_single_value->val.t.bytect;
# 1045|->           verified_table_value->bytes  = verified_single_value->val.t.bytes;
# 1046|             free(verified_single_value);  // n. does not free bytes
# 1047|             *verified_value_loc = verified_table_value;

Error: CPPCHECK_WARNING (CWE-476): [#def558]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:127: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cbn
#  125|   
#  126|   void free_connector_bus_numbers(Connector_Bus_Numbers * cbn) {
#  127|->    free(cbn->name);
#  128|      free(cbn);
#  129|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def559]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:161:13: warning[-Wanalyzer-malloc-leak]: leak of 'cbn'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1477:5: enter_function: entry to 'search_all_businfo_records_by_connector_name'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1485:33: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1486:4: call_function: calling 'get_connector_bus_numbers' from 'search_all_businfo_records_by_connector_name'
#  159|   {
#  160|      bool debug = false;
#  161|->    int d = (IS_DBGTRC(debug, DDCA_TRC_NONE)) ? 1 : -1;
#  162|      DBGTRC_STARTING(debug, TRACE_GROUP, "dirname=%s, fn=|%s|", dirname, fn);
#  163|      assert(dirname);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def560]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:162:4: warning[-Wanalyzer-malloc-leak]: leak of 'cbn'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1477:5: enter_function: entry to 'search_all_businfo_records_by_connector_name'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1485:33: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1486:4: call_function: calling 'get_connector_bus_numbers' from 'search_all_businfo_records_by_connector_name'
#  160|      bool debug = false;
#  161|      int d = (IS_DBGTRC(debug, DDCA_TRC_NONE)) ? 1 : -1;
#  162|->    DBGTRC_STARTING(debug, TRACE_GROUP, "dirname=%s, fn=|%s|", dirname, fn);
#  163|      assert(dirname);
#  164|      assert(fn);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def561]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:168:28: warning[-Wanalyzer-malloc-leak]: leak of 'cbn'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1477:5: enter_function: entry to 'search_all_businfo_records_by_connector_name'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1485:33: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1486:4: call_function: calling 'get_connector_bus_numbers' from 'search_all_businfo_records_by_connector_name'
#  166|      bool validate_name = debug;
#  167|   
#  168|->    bool is_dp_connector = (str_contains(fn, "-DP-") > 0) ;
#  169|      DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "is_dp_connector=%s", sbool(is_dp_connector));
#  170|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def562]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:169:4: warning[-Wanalyzer-malloc-leak]: leak of 'cbn'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1477:5: enter_function: entry to 'search_all_businfo_records_by_connector_name'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1485:33: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1486:4: call_function: calling 'get_connector_bus_numbers' from 'search_all_businfo_records_by_connector_name'
#  167|   
#  168|      bool is_dp_connector = (str_contains(fn, "-DP-") > 0) ;
#  169|->    DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "is_dp_connector=%s", sbool(is_dp_connector));
#  170|   
#  171|      cbn->i2c_busno = -1;      // 0 is valid bus number

Error: CPPCHECK_WARNING (CWE-476): [#def563]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:171: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cbn
#  169|      DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "is_dp_connector=%s", sbool(is_dp_connector));
#  170|   
#  171|->    cbn->i2c_busno = -1;      // 0 is valid bus number
#  172|      cbn->base_busno = -1;
#  173|      cbn->connector_id = -1;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def564]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:171:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cbn'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1477:5: enter_function: entry to 'search_all_businfo_records_by_connector_name'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1485:33: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1486:4: call_function: calling 'get_connector_bus_numbers' from 'search_all_businfo_records_by_connector_name'
#  169|      DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "is_dp_connector=%s", sbool(is_dp_connector));
#  170|   
#  171|->    cbn->i2c_busno = -1;      // 0 is valid bus number
#  172|      cbn->base_busno = -1;
#  173|      cbn->connector_id = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def565]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:172: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cbn
#  170|   
#  171|      cbn->i2c_busno = -1;      // 0 is valid bus number
#  172|->    cbn->base_busno = -1;
#  173|      cbn->connector_id = -1;
#  174|   

Error: CPPCHECK_WARNING (CWE-476): [#def566]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:173: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cbn
#  171|      cbn->i2c_busno = -1;      // 0 is valid bus number
#  172|      cbn->base_busno = -1;
#  173|->    cbn->connector_id = -1;
#  174|   
#  175|      int connector_id;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def567]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:176:17: warning[-Wanalyzer-malloc-leak]: leak of 'cbn'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1477:5: enter_function: entry to 'search_all_businfo_records_by_connector_name'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1485:33: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1486:4: call_function: calling 'get_connector_bus_numbers' from 'search_all_businfo_records_by_connector_name'
#  174|   
#  175|      int connector_id;
#  176|->    bool found = RPT_ATTR_INT(d, &connector_id, dirname, fn, "connector_id");
#  177|      if (found)
#  178|         cbn->connector_id = connector_id;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def568]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:191:13: warning[-Wanalyzer-malloc-leak]: leak of 'cbn'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1477:5: enter_function: entry to 'search_all_businfo_records_by_connector_name'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1485:33: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1486:4: call_function: calling 'get_connector_bus_numbers' from 'search_all_businfo_records_by_connector_name'
#  189|         char * drm_dp_aux_dir = NULL;
#  190|         bool has_drm_dp_aux_dir =    // does it exist? e.g. /sys/class/drm/card0-DP-1/drm_dp_aux0
#  191|->             RPT_ATTR_SINGLE_SUBDIR(d0, &drm_dp_aux_dir, fn_starts_with, "drm_dp_aux", dirname, fn);
#  192|         DBGTRC_NOPREFIX(debug, DDCA_TRC_NONE, "has_drm_dp_aux_dir=%s, drm_dp_aux_dir = %s",
#  193|               SBOOL(has_drm_dp_aux_dir), drm_dp_aux_dir);

Error: CPPCHECK_WARNING (CWE-476): [#def569]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:455: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cbn
#  453|      get_connector_bus_numbers(dirname, fn, cbn);
#  454|   
#  455|->    if (cbn->i2c_busno == accum->busno) {
#  456|         terminate = true;
#  457|         accum->connector_name = g_strdup(fn);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def570]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:770:4: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(simple_fn)'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:769:43: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:770:4: danger: 'strdup(simple_fn)' leaks here; was allocated at [(1)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/0)
#  768|   
#  769|      g_ptr_array_add(accum->all_connectors, strdup(simple_fn));
#  770|->    possibly_write_detect_to_status_by_connector_name(simple_fn);
#  771|      bool collect = GET_ATTR_EDID(NULL, dirname, simple_fn, "edid");
#  772|      if (collect) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def571]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1055:4: warning[-Wanalyzer-malloc-leak]: leak of 'accum'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1053:44: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1055:4: danger: 'accum' leaks here; was allocated at [(1)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/0)
# 1053|      Sysfs_Reliability_Accumulator * accum = calloc(1, sizeof(Sysfs_Reliability_Accumulator));
# 1054|      int depth=0;
# 1055|->    dir_foreach(
# 1056|            "/sys/class/drm",
# 1057|            predicate_cardN_connector,       // filter function

Error: CPPCHECK_WARNING (CWE-476): [#def572]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1063: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: accum
# 1061|   
# 1062|      drm_reliability_checked = true;
# 1063|->    nvidia_connectors_exist = (accum->nvidia_connector_ct > 0);
# 1064|      // known_good_driver_seen = > 0;
# 1065|      // This appears to be a necessary, but not sufficient, condition

Error: CPPCHECK_WARNING (CWE-476): [#def573]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1067: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: accum
# 1065|      // This appears to be a necessary, but not sufficient, condition
# 1066|      nvidia_connectors_reliable =
# 1067|->          accum->nvidia_connector_w_edid_ct > 0 &&
# 1068|            accum->nvidia_connector_w_edid_ct == accum->nvidia_connector_w_edid_and_connected_ct;
# 1069|      other_drivers_seen = accum->other_driver_seen;

Error: CPPCHECK_WARNING (CWE-476): [#def574]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1068: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: accum
# 1066|      nvidia_connectors_reliable =
# 1067|            accum->nvidia_connector_w_edid_ct > 0 &&
# 1068|->          accum->nvidia_connector_w_edid_ct == accum->nvidia_connector_w_edid_and_connected_ct;
# 1069|      other_drivers_seen = accum->other_driver_seen;
# 1070|      free(accum);

Error: CPPCHECK_WARNING (CWE-476): [#def575]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1069: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: accum
# 1067|            accum->nvidia_connector_w_edid_ct > 0 &&
# 1068|            accum->nvidia_connector_w_edid_ct == accum->nvidia_connector_w_edid_and_connected_ct;
# 1069|->    other_drivers_seen = accum->other_driver_seen;
# 1070|      free(accum);
# 1071|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def576]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:22: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'rp1'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1246:4: branch_true: following 'true' branch (when 'path' is non-NULL)...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1247:17: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1250:17: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:10: branch_true: following 'true' branch (when 'devpath' is NULL)...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:22: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:22: danger: 'rp1' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/2)
# 1252|   
# 1253|      // strlen(rp1) > 1  shuld be unnecessary, but just in case:
# 1254|->    while(!devpath && strlen(rp1) > 0 && !streq(rp1, "/")) {
# 1255|         if ( RPT_ATTR_TEXT(depth, NULL, rp1, "class")) {
# 1256|             devpath = rp1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def577]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:42: warning[-Wanalyzer-malloc-leak]: leak of 'rp1'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1246:4: branch_true: following 'true' branch (when 'path' is non-NULL)...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1247:17: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1250:17: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:10: branch_true: following 'true' branch (when 'devpath' is NULL)...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:22: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:42: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:42: danger: 'rp1' leaks here; was allocated at [(3)](sarif:/runs/0/results/20/codeFlows/0/threadFlows/0/locations/2)
# 1252|   
# 1253|      // strlen(rp1) > 1  shuld be unnecessary, but just in case:
# 1254|->    while(!devpath && strlen(rp1) > 0 && !streq(rp1, "/")) {
# 1255|         if ( RPT_ATTR_TEXT(depth, NULL, rp1, "class")) {
# 1256|             devpath = rp1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def578]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1255:12: warning[-Wanalyzer-malloc-leak]: leak of 'rp1'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1246:4: branch_true: following 'true' branch (when 'path' is non-NULL)...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1247:17: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1250:17: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:10: branch_true: following 'true' branch (when 'devpath' is NULL)...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:22: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:42: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1255:12: branch_false: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1255:12: danger: 'rp1' leaks here; was allocated at [(3)](sarif:/runs/0/results/21/codeFlows/0/threadFlows/0/locations/2)
# 1253|      // strlen(rp1) > 1  shuld be unnecessary, but just in case:
# 1254|      while(!devpath && strlen(rp1) > 0 && !streq(rp1, "/")) {
# 1255|->       if ( RPT_ATTR_TEXT(depth, NULL, rp1, "class")) {
# 1256|             devpath = rp1;
# 1257|         }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def579]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1259:10: warning[-Wanalyzer-malloc-leak]: leak of 'rp1'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1246:4: branch_true: following 'true' branch (when 'path' is non-NULL)...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1247:17: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1250:17: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:10: branch_true: following 'true' branch (when 'devpath' is NULL)...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:22: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:42: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1255:12: branch_false: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1255:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1259:10: branch_false: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1259:10: danger: 'rp1' leaks here; was allocated at [(3)](sarif:/runs/0/results/22/codeFlows/0/threadFlows/0/locations/2)
# 1257|         }
# 1258|         else {
# 1259|->          RPT_ATTR_REALPATH(depth, &rp2, rp1, "..");
# 1260|            free(rp1);
# 1261|            rp1 = rp2;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def580]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1268:4: warning[-Wanalyzer-malloc-leak]: leak of 'devpath'
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1246:4: branch_true: following 'true' branch (when 'path' is non-NULL)...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1247:17: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1250:17: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:10: branch_true: following 'true' branch (when 'devpath' is NULL)...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:22: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:42: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1255:12: branch_false: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1255:10: branch_true: following 'true' branch...
 branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1254:10: branch_false: following 'false' branch (when 'devpath' is non-NULL)...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1265:7: branch_false: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1265:7: branch_false: following 'false' branch (when 'devpath' is non-NULL)...
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1268:4: branch_false: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1268:4: danger: 'devpath' leaks here; was allocated at [(3)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/2)
# 1266|         free(rp1);
# 1267|   
# 1268|->    DBGTRC_DONE(debug,TRACE_GROUP, "Returning: %s", devpath);
# 1269|      return devpath;
# 1270|   }

Error: CPPCHECK_WARNING (CWE-476): [#def581]
ddcutil-2.2.1/src/sysfs/sysfs_base.c:1487: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cbn
# 1485|      Connector_Bus_Numbers *cbn = calloc(1, sizeof(Connector_Bus_Numbers));
# 1486|      get_connector_bus_numbers("/sys/class/drm", connector_name, cbn);
# 1487|->    int busno = cbn->i2c_busno;
# 1488|      free_connector_bus_numbers(cbn);
# 1489|      if (busno < 0) {

Error: CPPCHECK_WARNING (CWE-476): [#def582]
ddcutil-2.2.1/src/sysfs/sysfs_conflicting_drivers.c:114: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: conflicting_driver
#  112|      Sys_Conflicting_Driver * conflicting_driver = calloc(1, sizeof(Sys_Conflicting_Driver));
#  113|      DBGMSF(debug, "Allocated Sys_Conflicting_Driver %p", (void*) conflicting_driver);
#  114|->    conflicting_driver->n_nnnn = g_strdup(fn);
#  115|   
#  116|      RPT_ATTR_TEXT(depth, &conflicting_driver->name, dir_name, fn, "name");

Error: GCC_ANALYZER_WARNING (CWE-476): [#def583]
ddcutil-2.2.1/src/sysfs/sysfs_conflicting_drivers.c:114:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'conflicting_driver'
ddcutil-2.2.1/src/sysfs/sysfs_conflicting_drivers.c:102:6: enter_function: entry to 'one_n_nnnn'
ddcutil-2.2.1/src/sysfs/sysfs_conflicting_drivers.c:112:50: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/sysfs/sysfs_conflicting_drivers.c:114:4: danger: 'conflicting_driver' could be NULL: unchecked value from [(2)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/1)
#  112|      Sys_Conflicting_Driver * conflicting_driver = calloc(1, sizeof(Sys_Conflicting_Driver));
#  113|      DBGMSF(debug, "Allocated Sys_Conflicting_Driver %p", (void*) conflicting_driver);
#  114|->    conflicting_driver->n_nnnn = g_strdup(fn);
#  115|   
#  116|      RPT_ATTR_TEXT(depth, &conflicting_driver->name, dir_name, fn, "name");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def584]
ddcutil-2.2.1/src/sysfs/sysfs_conflicting_drivers.c:116:4: warning[-Wanalyzer-malloc-leak]: leak of 'conflicting_driver'
ddcutil-2.2.1/src/sysfs/sysfs_conflicting_drivers.c:102:6: enter_function: entry to 'one_n_nnnn'
ddcutil-2.2.1/src/sysfs/sysfs_conflicting_drivers.c:112:50: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_conflicting_drivers.c:116:4: danger: 'conflicting_driver' leaks here; was allocated at [(2)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/1)
#  114|      conflicting_driver->n_nnnn = g_strdup(fn);
#  115|   
#  116|->    RPT_ATTR_TEXT(depth, &conflicting_driver->name, dir_name, fn, "name");
#  117|   
#  118|      if (str_ends_with(fn, "0050")) {

Error: CPPCHECK_WARNING (CWE-476): [#def585]
ddcutil-2.2.1/src/sysfs/sysfs_i2c_info.c:156: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  154|      g_snprintf(bus_path, 40, "/sys/bus/i2c/devices/i2c-%d", busno);
#  155|      Sysfs_I2C_Info * result = calloc(1, sizeof(Sysfs_I2C_Info));
#  156|->    result->busno = busno;
#  157|      RPT_ATTR_TEXT(depth, &result->name, bus_path, "name");
#  158|      char * adapter_path  = sysfs_find_adapter(bus_path);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def586]
ddcutil-2.2.1/src/sysfs/sysfs_i2c_info.c:156:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/sysfs/sysfs_i2c_info.c:155:30: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/sysfs/sysfs_i2c_info.c:156:4: danger: 'result' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  154|      g_snprintf(bus_path, 40, "/sys/bus/i2c/devices/i2c-%d", busno);
#  155|      Sysfs_I2C_Info * result = calloc(1, sizeof(Sysfs_I2C_Info));
#  156|->    result->busno = busno;
#  157|      RPT_ATTR_TEXT(depth, &result->name, bus_path, "name");
#  158|      char * adapter_path  = sysfs_find_adapter(bus_path);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def587]
ddcutil-2.2.1/src/sysfs/sysfs_i2c_info.c:157:4: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/sysfs/sysfs_i2c_info.c:155:30: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_i2c_info.c:157:4: danger: 'result' leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  155|      Sysfs_I2C_Info * result = calloc(1, sizeof(Sysfs_I2C_Info));
#  156|      result->busno = busno;
#  157|->    RPT_ATTR_TEXT(depth, &result->name, bus_path, "name");
#  158|      char * adapter_path  = sysfs_find_adapter(bus_path);
#  159|      if (adapter_path) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def588]
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:91:4: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:328:1: enter_function: entry to 'get_i2c_sys_info'
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:348:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:349:16: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:349:16: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:355:7: call_function: calling 'read_i2cN_device_node' from 'get_i2c_sys_info'
#   89|      assert(info);
#   90|      bool debug = false;
#   91|->    DBGTRC_STARTING(debug, TRACE_GROUP, "device_path=%s", device_path);
#   92|      int d0 = (depth < 0 && IS_DBGTRC(debug, TRACE_GROUP)) ? 2 : depth;
#   93|      assert(device_path);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def589]
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:92:27: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:328:1: enter_function: entry to 'get_i2c_sys_info'
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:348:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:349:16: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:349:16: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:355:7: call_function: calling 'read_i2cN_device_node' from 'get_i2c_sys_info'
#   90|      bool debug = false;
#   91|      DBGTRC_STARTING(debug, TRACE_GROUP, "device_path=%s", device_path);
#   92|->    int d0 = (depth < 0 && IS_DBGTRC(debug, TRACE_GROUP)) ? 2 : depth;
#   93|      assert(device_path);
#   94|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def590]
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:95:19: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:328:1: enter_function: entry to 'get_i2c_sys_info'
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:348:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:349:16: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:349:16: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:355:7: call_function: calling 'read_i2cN_device_node' from 'get_i2c_sys_info'
#   93|      assert(device_path);
#   94|   
#   95|->    char * i2c_N = g_path_get_basename(device_path);
#   96|      RPT_ATTR_TEXT( d0, &info->device_name,    device_path, "name");
#   97|      RPT_ATTR_TEXT( d0, &info->i2c_dev_dev,    device_path, "i2c-dev", i2c_N, "dev");

Error: GCC_ANALYZER_WARNING (CWE-401): [#def591]
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:96:4: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:328:1: enter_function: entry to 'get_i2c_sys_info'
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:348:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:349:16: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:349:16: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:355:7: call_function: calling 'read_i2cN_device_node' from 'get_i2c_sys_info'
#   94|   
#   95|      char * i2c_N = g_path_get_basename(device_path);
#   96|->    RPT_ATTR_TEXT( d0, &info->device_name,    device_path, "name");
#   97|      RPT_ATTR_TEXT( d0, &info->i2c_dev_dev,    device_path, "i2c-dev", i2c_N, "dev");
#   98|      RPT_ATTR_TEXT( d0, &info->i2c_dev_name,   device_path, "i2c-dev", i2c_N, "name");

Error: CPPCHECK_WARNING (CWE-476): [#def592]
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:350: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  348|      if (directory_exists(i2c_device_path)) {
#  349|         result = calloc(1, sizeof(I2C_Sys_Info));
#  350|->       result->busno = busno;
#  351|         // real path is in /sys/devices tree
#  352|         RPT_ATTR_REALPATH(d1, &pci_i2c_device_path, i2c_device_path);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def593]
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:350:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:348:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:349:16: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:349:16: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:350:7: danger: 'result' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/2)
#  348|      if (directory_exists(i2c_device_path)) {
#  349|         result = calloc(1, sizeof(I2C_Sys_Info));
#  350|->       result->busno = busno;
#  351|         // real path is in /sys/devices tree
#  352|         RPT_ATTR_REALPATH(d1, &pci_i2c_device_path, i2c_device_path);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def594]
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:352:7: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:348:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:349:16: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:349:16: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:352:7: danger: 'result' leaks here; was allocated at [(3)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/2)
#  350|         result->busno = busno;
#  351|         // real path is in /sys/devices tree
#  352|->       RPT_ATTR_REALPATH(d1, &pci_i2c_device_path, i2c_device_path);
#  353|         result->pci_device_path = pci_i2c_device_path;
#  354|         DBGTRC_NOPREFIX(debug, TRACE_GROUP, "pci_i2c_device_path=%s", pci_i2c_device_path);

Error: CPPCHECK_WARNING (CWE-476): [#def595]
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:353: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  351|         // real path is in /sys/devices tree
#  352|         RPT_ATTR_REALPATH(d1, &pci_i2c_device_path, i2c_device_path);
#  353|->       result->pci_device_path = pci_i2c_device_path;
#  354|         DBGTRC_NOPREFIX(debug, TRACE_GROUP, "pci_i2c_device_path=%s", pci_i2c_device_path);
#  355|         read_i2cN_device_node(pci_i2c_device_path, result, d1);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def596]
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:354:7: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:348:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:349:16: branch_true: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:349:16: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_i2c_sys_info.c:354:7: danger: 'result' leaks here; was allocated at [(3)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/2)
#  352|         RPT_ATTR_REALPATH(d1, &pci_i2c_device_path, i2c_device_path);
#  353|         result->pci_device_path = pci_i2c_device_path;
#  354|->       DBGTRC_NOPREFIX(debug, TRACE_GROUP, "pci_i2c_device_path=%s", pci_i2c_device_path);
#  355|         read_i2cN_device_node(pci_i2c_device_path, result, d1);
#  356|   

Error: CPPCHECK_WARNING (CWE-476): [#def597]
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:190: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur
#  188|   
#  189|      Sys_Drm_Connector * cur = calloc(1, sizeof(Sys_Drm_Connector));
#  190|->    cur->i2c_busno = -1;      // 0 is valid bus number
#  191|      cur->base_busno = -1;
#  192|      cur->connector_id = -1;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def598]
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:190:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur'
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:189:30: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:190:4: danger: 'cur' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  188|   
#  189|      Sys_Drm_Connector * cur = calloc(1, sizeof(Sys_Drm_Connector));
#  190|->    cur->i2c_busno = -1;      // 0 is valid bus number
#  191|      cur->base_busno = -1;
#  192|      cur->connector_id = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def599]
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:191: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur
#  189|      Sys_Drm_Connector * cur = calloc(1, sizeof(Sys_Drm_Connector));
#  190|      cur->i2c_busno = -1;      // 0 is valid bus number
#  191|->    cur->base_busno = -1;
#  192|      cur->connector_id = -1;
#  193|      cur->connector_name = g_strdup(fn);   // e.g. card0-DP-1

Error: CPPCHECK_WARNING (CWE-476): [#def600]
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:192: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur
#  190|      cur->i2c_busno = -1;      // 0 is valid bus number
#  191|      cur->base_busno = -1;
#  192|->    cur->connector_id = -1;
#  193|      cur->connector_name = g_strdup(fn);   // e.g. card0-DP-1
#  194|      RPT_ATTR_INT(     d0, &cur->connector_id, dirname, fn, "connector_id");

Error: CPPCHECK_WARNING (CWE-476): [#def601]
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:193: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur
#  191|      cur->base_busno = -1;
#  192|      cur->connector_id = -1;
#  193|->    cur->connector_name = g_strdup(fn);   // e.g. card0-DP-1
#  194|      RPT_ATTR_INT(     d0, &cur->connector_id, dirname, fn, "connector_id");
#  195|      RPT_ATTR_REALPATH(d0, &cur->connector_path, dirname, fn);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def602]
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:194:4: warning[-Wanalyzer-malloc-leak]: leak of 'cur'
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:178:21: enter_function: entry to 'one_drm_connector0'
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:189:30: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:194:4: danger: 'cur' leaks here; was allocated at [(2)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/1)
#  192|      cur->connector_id = -1;
#  193|      cur->connector_name = g_strdup(fn);   // e.g. card0-DP-1
#  194|->    RPT_ATTR_INT(     d0, &cur->connector_id, dirname, fn, "connector_id");
#  195|      RPT_ATTR_REALPATH(d0, &cur->connector_path, dirname, fn);
#  196|   

Error: CPPCHECK_WARNING (CWE-476): [#def603]
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:198: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur
#  196|   
#  197|      GByteArray * edid_byte_array = NULL;
#  198|->    possibly_write_detect_to_status_by_connector_path(cur->connector_path);
#  199|      RPT_ATTR_EDID(d0, &edid_byte_array, dirname, fn, "edid");   // e.g. /sys/class/drm/card0-DP-1/edid
#  200|      // DBGMSG("edid_byte_array=%p", (void*)edid_byte_array);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def604]
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:208:4: warning[-Wanalyzer-malloc-leak]: leak of 'cbn'
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:201:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:207:34: branch_false: ...to here
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:207:34: acquire_memory: allocated here
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:208:4: danger: 'cbn' leaks here; was allocated at [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
#  206|   
#  207|      Connector_Bus_Numbers * cbn = calloc(1, sizeof(Connector_Bus_Numbers));
#  208|->    get_connector_bus_numbers(dirname, fn, cbn);
#  209|      cur->base_busno = cbn->base_busno;
#  210|      cur->i2c_busno = cbn->i2c_busno;

Error: CPPCHECK_WARNING (CWE-476): [#def605]
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:209: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cbn
#  207|      Connector_Bus_Numbers * cbn = calloc(1, sizeof(Connector_Bus_Numbers));
#  208|      get_connector_bus_numbers(dirname, fn, cbn);
#  209|->    cur->base_busno = cbn->base_busno;
#  210|      cur->i2c_busno = cbn->i2c_busno;
#  211|      cur->connector_id = cbn->connector_id;

Error: CPPCHECK_WARNING (CWE-476): [#def606]
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:209: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur
#  207|      Connector_Bus_Numbers * cbn = calloc(1, sizeof(Connector_Bus_Numbers));
#  208|      get_connector_bus_numbers(dirname, fn, cbn);
#  209|->    cur->base_busno = cbn->base_busno;
#  210|      cur->i2c_busno = cbn->i2c_busno;
#  211|      cur->connector_id = cbn->connector_id;

Error: CPPCHECK_WARNING (CWE-476): [#def607]
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:210: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cbn
#  208|      get_connector_bus_numbers(dirname, fn, cbn);
#  209|      cur->base_busno = cbn->base_busno;
#  210|->    cur->i2c_busno = cbn->i2c_busno;
#  211|      cur->connector_id = cbn->connector_id;
#  212|      free_connector_bus_numbers(cbn);

Error: CPPCHECK_WARNING (CWE-476): [#def608]
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:210: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur
#  208|      get_connector_bus_numbers(dirname, fn, cbn);
#  209|      cur->base_busno = cbn->base_busno;
#  210|->    cur->i2c_busno = cbn->i2c_busno;
#  211|      cur->connector_id = cbn->connector_id;
#  212|      free_connector_bus_numbers(cbn);

Error: CPPCHECK_WARNING (CWE-476): [#def609]
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:211: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cbn
#  209|      cur->base_busno = cbn->base_busno;
#  210|      cur->i2c_busno = cbn->i2c_busno;
#  211|->    cur->connector_id = cbn->connector_id;
#  212|      free_connector_bus_numbers(cbn);
#  213|      possibly_write_detect_to_status_by_connector_name(fn);

Error: CPPCHECK_WARNING (CWE-476): [#def610]
ddcutil-2.2.1/src/sysfs/sysfs_sys_drm_connector.c:211: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur
#  209|      cur->base_busno = cbn->base_busno;
#  210|      cur->i2c_busno = cbn->i2c_busno;
#  211|->    cur->connector_id = cbn->connector_id;
#  212|      free_connector_bus_numbers(cbn);
#  213|      possibly_write_detect_to_status_by_connector_name(fn);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def611]
ddcutil-2.2.1/src/usb/usb_base.c:89:4: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(hiddev_devname,  mode)'
ddcutil-2.2.1/src/usb/usb_base.c:89:4: acquire_resource: opened here
ddcutil-2.2.1/src/usb/usb_base.c:89:4: danger: 'open(hiddev_devname,  mode)' leaks here; was opened at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   87|      int mode = (calloptions & CALLOPT_RDONLY) ? O_RDONLY : O_RDWR;
#   88|   
#   89|->    RECORD_IO_EVENT(
#   90|            -1,
#   91|            IE_OPEN,

Error: GCC_ANALYZER_WARNING (CWE-775): [#def612]
ddcutil-2.2.1/src/usb/usb_base.c:107:4: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'file'
ddcutil-2.2.1/src/usb/usb_base.c:89:4: acquire_resource: opened here
ddcutil-2.2.1/src/usb/usb_base.c:98:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_base.c:107:4: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_base.c:107:4: danger: 'file' leaks here; was opened at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  105|   
#  106|   
#  107|->    DBGTRC(debug, TRACE_GROUP, "Returning file descriptor: %d", file);
#  108|      return file;
#  109|   }

Error: CPPCHECK_WARNING (CWE-476): [#def613]
ddcutil-2.2.1/src/usb/usb_base.c:313: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ignored_vid_pids
#  311|      if (ignored_ct > 0) {
#  312|         ignored_vid_pids = calloc(ignored_ct, sizeof(uint32_t));
#  313|->       memcpy(ignored_vid_pids, ignored, ignored_ct*sizeof(uint32_t));
#  314|      }
#  315|      if (debug || IS_TRACING()) {

Error: CPPCHECK_WARNING (CWE-476): [#def614]
ddcutil-2.2.1/src/usb/usb_displays.c:194: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: vcprec
#  192|      DBGTRC_STARTING(debug, TRACE_GROUP, "feature_code=0x%02x", feature_code);
#  193|      Usb_Monitor_Vcp_Rec * vcprec = calloc(1, sizeof(Usb_Monitor_Vcp_Rec));
#  194|->    memcpy(vcprec->marker, USB_MONITOR_VCP_REC_MARKER, 4);
#  195|      vcprec->vcp_code = feature_code;
#  196|      DBGTRC_DONE(debug, TRACE_GROUP, "Returning: %p", vcprec);

Error: CPPCHECK_WARNING (CWE-476): [#def615]
ddcutil-2.2.1/src/usb/usb_displays.c:195: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: vcprec
#  193|      Usb_Monitor_Vcp_Rec * vcprec = calloc(1, sizeof(Usb_Monitor_Vcp_Rec));
#  194|      memcpy(vcprec->marker, USB_MONITOR_VCP_REC_MARKER, 4);
#  195|->    vcprec->vcp_code = feature_code;
#  196|      DBGTRC_DONE(debug, TRACE_GROUP, "Returning: %p", vcprec);
#  197|      return vcprec;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def616]
ddcutil-2.2.1/src/usb/usb_displays.c:195:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'vcprec'
ddcutil-2.2.1/src/usb/usb_displays.c:193:35: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb/usb_displays.c:195:4: danger: 'vcprec' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  193|      Usb_Monitor_Vcp_Rec * vcprec = calloc(1, sizeof(Usb_Monitor_Vcp_Rec));
#  194|      memcpy(vcprec->marker, USB_MONITOR_VCP_REC_MARKER, 4);
#  195|->    vcprec->vcp_code = feature_code;
#  196|      DBGTRC_DONE(debug, TRACE_GROUP, "Returning: %p", vcprec);
#  197|      return vcprec;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def617]
ddcutil-2.2.1/src/usb/usb_displays.c:196:4: warning[-Wanalyzer-malloc-leak]: leak of 'vcprec'
ddcutil-2.2.1/src/usb/usb_displays.c:193:35: acquire_memory: allocated here
ddcutil-2.2.1/src/usb/usb_displays.c:196:4: danger: 'vcprec' leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  194|      memcpy(vcprec->marker, USB_MONITOR_VCP_REC_MARKER, 4);
#  195|      vcprec->vcp_code = feature_code;
#  196|->    DBGTRC_DONE(debug, TRACE_GROUP, "Returning: %p", vcprec);
#  197|      return vcprec;
#  198|   }

Error: CPPCHECK_WARNING (CWE-476): [#def618]
ddcutil-2.2.1/src/usb/usb_displays.c:273: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: infoptr
#  271|                   vcprec->usage_index = undx;
#  272|                   struct hiddev_report_info * infoptr = malloc(sizeof(struct hiddev_report_info));
#  273|->                 memcpy(infoptr, &rinfo, sizeof(struct hiddev_report_info));
#  274|                   vcprec->rinfo = infoptr;
#  275|                   struct hiddev_field_info * fptr = malloc(sizeof(struct hiddev_field_info));

Error: GCC_ANALYZER_WARNING (CWE-476): [#def619]
ddcutil-2.2.1/src/usb/usb_displays.c:273:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'infoptr'
ddcutil-2.2.1/src/usb/usb_displays.c:213:50: branch_true: following 'true' branch (when 'report_type != 4')...
ddcutil-2.2.1/src/usb/usb_displays.c:215:33: branch_true: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:227:14: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:233:15: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:233:14: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:237:26: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:239:39: branch_true: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:248:17: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:250:18: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:250:17: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:253:29: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:254:41: branch_true: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:261:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:263:23: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:263:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:265:22: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:272:55: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb/usb_displays.c:273:17: danger: 'infoptr' could be NULL: unchecked value from [(19)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/18)
#  271|                   vcprec->usage_index = undx;
#  272|                   struct hiddev_report_info * infoptr = malloc(sizeof(struct hiddev_report_info));
#  273|->                 memcpy(infoptr, &rinfo, sizeof(struct hiddev_report_info));
#  274|                   vcprec->rinfo = infoptr;
#  275|                   struct hiddev_field_info * fptr = malloc(sizeof(struct hiddev_field_info));

Error: CPPCHECK_WARNING (CWE-476): [#def620]
ddcutil-2.2.1/src/usb/usb_displays.c:276: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: fptr
#  274|                   vcprec->rinfo = infoptr;
#  275|                   struct hiddev_field_info * fptr = malloc(sizeof(struct hiddev_field_info));
#  276|->                 memcpy(fptr, &finfo, sizeof(struct hiddev_field_info));
#  277|                   vcprec->finfo = fptr;
#  278|                   struct hiddev_usage_ref * uptr = malloc(sizeof(struct hiddev_usage_ref));

Error: GCC_ANALYZER_WARNING (CWE-476): [#def621]
ddcutil-2.2.1/src/usb/usb_displays.c:276:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'fptr'
ddcutil-2.2.1/src/usb/usb_displays.c:213:50: branch_true: following 'true' branch (when 'report_type != 4')...
ddcutil-2.2.1/src/usb/usb_displays.c:215:33: branch_true: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:227:14: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:233:15: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:233:14: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:237:26: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:239:39: branch_true: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:248:17: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:250:18: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:250:17: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:253:29: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:254:41: branch_true: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:261:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:263:23: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:263:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:265:22: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:275:51: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb/usb_displays.c:276:17: danger: 'fptr' could be NULL: unchecked value from [(19)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/18)
#  274|                   vcprec->rinfo = infoptr;
#  275|                   struct hiddev_field_info * fptr = malloc(sizeof(struct hiddev_field_info));
#  276|->                 memcpy(fptr, &finfo, sizeof(struct hiddev_field_info));
#  277|                   vcprec->finfo = fptr;
#  278|                   struct hiddev_usage_ref * uptr = malloc(sizeof(struct hiddev_usage_ref));

Error: CPPCHECK_WARNING (CWE-476): [#def622]
ddcutil-2.2.1/src/usb/usb_displays.c:279: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: uptr
#  277|                   vcprec->finfo = fptr;
#  278|                   struct hiddev_usage_ref * uptr = malloc(sizeof(struct hiddev_usage_ref));
#  279|->                 memcpy(uptr, &uref, sizeof(struct hiddev_usage_ref));
#  280|                   vcprec->uref = uptr;;
#  281|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def623]
ddcutil-2.2.1/src/usb/usb_displays.c:279:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'uptr'
ddcutil-2.2.1/src/usb/usb_displays.c:213:50: branch_true: following 'true' branch (when 'report_type != 4')...
ddcutil-2.2.1/src/usb/usb_displays.c:215:33: branch_true: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:227:14: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:233:15: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:233:14: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:237:26: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:239:39: branch_true: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:248:17: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:250:18: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:250:17: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:253:29: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:254:41: branch_true: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:261:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:263:23: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:263:20: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_displays.c:265:22: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_displays.c:278:50: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb/usb_displays.c:279:17: danger: 'uptr' could be NULL: unchecked value from [(19)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/18)
#  277|                   vcprec->finfo = fptr;
#  278|                   struct hiddev_usage_ref * uptr = malloc(sizeof(struct hiddev_usage_ref));
#  279|->                 memcpy(uptr, &uref, sizeof(struct hiddev_usage_ref));
#  280|                   vcprec->uref = uptr;;
#  281|   

Error: CPPCHECK_WARNING (CWE-476): [#def624]
ddcutil-2.2.1/src/usb/usb_displays.c:425: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: moninfo
#  423|      DBGTRC_STARTING(debug, TRACE_GROUP, "hiddev_name |%s|", hiddev_name);
#  424|      Usb_Monitor_Info * moninfo = calloc(1,sizeof(Usb_Monitor_Info));
#  425|->    memcpy(moninfo->marker, USB_MONITOR_INFO_MARKER, 4);
#  426|      moninfo->hiddev_device_name = g_strdup(hiddev_name);
#  427|   #ifdef ALT_LOCK_REC

Error: CPPCHECK_WARNING (CWE-476): [#def625]
ddcutil-2.2.1/src/usb/usb_displays.c:426: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: moninfo
#  424|      Usb_Monitor_Info * moninfo = calloc(1,sizeof(Usb_Monitor_Info));
#  425|      memcpy(moninfo->marker, USB_MONITOR_INFO_MARKER, 4);
#  426|->    moninfo->hiddev_device_name = g_strdup(hiddev_name);
#  427|   #ifdef ALT_LOCK_REC
#  428|      moninfo->lock_rec = create_display_lock_record(usb_io_path(hiddev_name_to_number(hiddev_name)));

Error: GCC_ANALYZER_WARNING (CWE-476): [#def626]
ddcutil-2.2.1/src/usb/usb_displays.c:426:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'moninfo'
ddcutil-2.2.1/src/usb/usb_displays.c:421:20: enter_function: entry to 'create_usb_monitor_info'
ddcutil-2.2.1/src/usb/usb_displays.c:424:33: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb/usb_displays.c:426:4: danger: 'moninfo' could be NULL: unchecked value from [(2)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/1)
#  424|      Usb_Monitor_Info * moninfo = calloc(1,sizeof(Usb_Monitor_Info));
#  425|      memcpy(moninfo->marker, USB_MONITOR_INFO_MARKER, 4);
#  426|->    moninfo->hiddev_device_name = g_strdup(hiddev_name);
#  427|   #ifdef ALT_LOCK_REC
#  428|      moninfo->lock_rec = create_display_lock_record(usb_io_path(hiddev_name_to_number(hiddev_name)));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def627]
ddcutil-2.2.1/src/usb/usb_displays.c:430:4: warning[-Wanalyzer-malloc-leak]: leak of 'moninfo'
ddcutil-2.2.1/src/usb/usb_displays.c:421:20: enter_function: entry to 'create_usb_monitor_info'
ddcutil-2.2.1/src/usb/usb_displays.c:424:33: acquire_memory: allocated here
ddcutil-2.2.1/src/usb/usb_displays.c:430:4: danger: 'moninfo' leaks here; was allocated at [(2)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/1)
#  428|      moninfo->lock_rec = create_display_lock_record(usb_io_path(hiddev_name_to_number(hiddev_name)));
#  429|      #endif
#  430|->    DBGTRC_DONE(debug, TRACE_GROUP, "Returning %p", moninfo);
#  431|      return moninfo;
#  432|   }

Error: CPPCHECK_WARNING (CWE-476): [#def628]
ddcutil-2.2.1/src/usb/usb_displays.c:522: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: boe
#  520|                  (detail) ? detail : "");
#  521|            boe = calloc(1, sizeof(Bus_Open_Error));
#  522|->          boe->io_mode = DDCA_IO_USB;
#  523|            boe->devno = hiddev_name_to_number(hiddev_fn);    // is this simple or fully qualified?
#  524|            boe->error = fd;

Error: CPPCHECK_WARNING (CWE-476): [#def629]
ddcutil-2.2.1/src/usb/usb_displays.c:523: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: boe
#  521|            boe = calloc(1, sizeof(Bus_Open_Error));
#  522|            boe->io_mode = DDCA_IO_USB;
#  523|->          boe->devno = hiddev_name_to_number(hiddev_fn);    // is this simple or fully qualified?
#  524|            boe->error = fd;
#  525|            boe->detail = detail;

Error: CPPCHECK_WARNING (CWE-476): [#def630]
ddcutil-2.2.1/src/usb/usb_displays.c:524: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: boe
#  522|            boe->io_mode = DDCA_IO_USB;
#  523|            boe->devno = hiddev_name_to_number(hiddev_fn);    // is this simple or fully qualified?
#  524|->          boe->error = fd;
#  525|            boe->detail = detail;
#  526|            g_ptr_array_add(usb_open_errors, boe);

Error: CPPCHECK_WARNING (CWE-476): [#def631]
ddcutil-2.2.1/src/usb/usb_displays.c:525: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: boe
#  523|            boe->devno = hiddev_name_to_number(hiddev_fn);    // is this simple or fully qualified?
#  524|            boe->error = fd;
#  525|->          boe->detail = detail;
#  526|            g_ptr_array_add(usb_open_errors, boe);
#  527|         }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def632]
ddcutil-2.2.1/src/usb/usb_displays.c:844:11: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
ddcutil-2.2.1/src/usb/usb_displays.c:842:1: enter_function: entry to 'usb_get_parsed_edid_by_dref'
ddcutil-2.2.1/src/usb/usb_displays.c:843:33: call_function: calling 'usb_find_monitor_by_dref' from 'usb_get_parsed_edid_by_dref'
ddcutil-2.2.1/src/usb/usb_displays.c:843:33: return_function: returning to 'usb_get_parsed_edid_by_dref' from 'usb_find_monitor_by_dref'
ddcutil-2.2.1/src/usb/usb_displays.c:844:11: danger: dereference of NULL 'usb_find_monitor_by_dref(dref)'
#  842|   usb_get_parsed_edid_by_dref(Display_Ref * dref) {
#  843|      Usb_Monitor_Info * moninfo = usb_find_monitor_by_dref(dref);
#  844|->    return moninfo->edid;
#  845|   }
#  846|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def633]
ddcutil-2.2.1/src/usb/usb_displays.c:851:11: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
ddcutil-2.2.1/src/usb/usb_displays.c:849:1: enter_function: entry to 'usb_get_parsed_edid_by_dh'
ddcutil-2.2.1/src/usb/usb_displays.c:850:33: call_function: calling 'usb_find_monitor_by_dh' from 'usb_get_parsed_edid_by_dh'
ddcutil-2.2.1/src/usb/usb_displays.c:850:33: return_function: returning to 'usb_get_parsed_edid_by_dh' from 'usb_find_monitor_by_dh'
ddcutil-2.2.1/src/usb/usb_displays.c:851:11: danger: dereference of NULL 'usb_find_monitor_by_dh(dh)'
#  849|   usb_get_parsed_edid_by_dh(Display_Handle * dh) {
#  850|      Usb_Monitor_Info * moninfo = usb_find_monitor_by_dh(dh);
#  851|->    return moninfo->edid;
#  852|   }
#  853|   

Error: CPPCHECK_WARNING (CWE-476): [#def634]
ddcutil-2.2.1/src/usb/usb_edid.c:179: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  177|         assert(modelsn->len >= 16);
#  178|         result = calloc(1, sizeof(struct model_sn_pair));
#  179|->       result->model = calloc(1,9);
#  180|         result->sn    = calloc(1,9);
#  181|         memcpy(result->sn, modelsn->bytes,8);

Error: CPPCHECK_WARNING (CWE-476): [#def635]
ddcutil-2.2.1/src/usb/usb_edid.c:180: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  178|         result = calloc(1, sizeof(struct model_sn_pair));
#  179|         result->model = calloc(1,9);
#  180|->       result->sn    = calloc(1,9);
#  181|         memcpy(result->sn, modelsn->bytes,8);
#  182|         result->sn[8] = '\0';

Error: CPPCHECK_WARNING (CWE-476): [#def636]
ddcutil-2.2.1/src/usb/usb_edid.c:181: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  179|         result->model = calloc(1,9);
#  180|         result->sn    = calloc(1,9);
#  181|->       memcpy(result->sn, modelsn->bytes,8);
#  182|         result->sn[8] = '\0';
#  183|         memcpy(result->model, modelsn->bytes+8, 8);

Error: CPPCHECK_WARNING (CWE-476): [#def637]
ddcutil-2.2.1/src/usb/usb_edid.c:182: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  180|         result->sn    = calloc(1,9);
#  181|         memcpy(result->sn, modelsn->bytes,8);
#  182|->       result->sn[8] = '\0';
#  183|         memcpy(result->model, modelsn->bytes+8, 8);
#  184|         result->model[8] = '\0';

Error: CPPCHECK_WARNING (CWE-476): [#def638]
ddcutil-2.2.1/src/usb/usb_edid.c:183: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  181|         memcpy(result->sn, modelsn->bytes,8);
#  182|         result->sn[8] = '\0';
#  183|->       memcpy(result->model, modelsn->bytes+8, 8);
#  184|         result->model[8] = '\0';
#  185|         rtrim_in_place(result->sn);

Error: CPPCHECK_WARNING (CWE-476): [#def639]
ddcutil-2.2.1/src/usb/usb_edid.c:184: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  182|         result->sn[8] = '\0';
#  183|         memcpy(result->model, modelsn->bytes+8, 8);
#  184|->       result->model[8] = '\0';
#  185|         rtrim_in_place(result->sn);
#  186|         rtrim_in_place(result->model);

Error: CPPCHECK_WARNING (CWE-476): [#def640]
ddcutil-2.2.1/src/usb/usb_edid.c:185: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  183|         memcpy(result->model, modelsn->bytes+8, 8);
#  184|         result->model[8] = '\0';
#  185|->       rtrim_in_place(result->sn);
#  186|         rtrim_in_place(result->model);
#  187|         free(modelsn);

Error: CPPCHECK_WARNING (CWE-476): [#def641]
ddcutil-2.2.1/src/usb/usb_edid.c:186: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  184|         result->model[8] = '\0';
#  185|         rtrim_in_place(result->sn);
#  186|->       rtrim_in_place(result->model);
#  187|         free(modelsn);
#  188|      }

Error: CPPCHECK_WARNING (CWE-476): [#def642]
ddcutil-2.2.1/src/usb/usb_vcp.c:491: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_response
#  489|      if (psc == 0) {
#  490|         parsed_response = calloc(1, sizeof(Parsed_Nontable_Vcp_Response));
#  491|->       parsed_response->vcp_code = feature_code;
#  492|         parsed_response->valid_response = true;
#  493|         parsed_response->supported_opcode = true;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def643]
ddcutil-2.2.1/src/usb/usb_vcp.c:491:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'parsed_response'
ddcutil-2.2.1/src/usb/usb_vcp.c:425:1: enter_function: entry to 'usb_get_nontable_vcp_value'
ddcutil-2.2.1/src/usb/usb_vcp.c:434:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_vcp.c:444:33: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_vcp.c:445:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_vcp.c:447:10: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_vcp.c:453:13: call_function: calling 'usb_get_usage_value_by_report_type_and_ucode' from 'usb_get_nontable_vcp_value'
ddcutil-2.2.1/src/usb/usb_vcp.c:453:13: return_function: returning to 'usb_get_nontable_vcp_value' from 'usb_get_usage_value_by_report_type_and_ucode'
ddcutil-2.2.1/src/usb/usb_vcp.c:490:25: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb/usb_vcp.c:491:7: danger: 'parsed_response' could be NULL: unchecked value from [(11)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/10)
#  489|      if (psc == 0) {
#  490|         parsed_response = calloc(1, sizeof(Parsed_Nontable_Vcp_Response));
#  491|->       parsed_response->vcp_code = feature_code;
#  492|         parsed_response->valid_response = true;
#  493|         parsed_response->supported_opcode = true;

Error: CPPCHECK_WARNING (CWE-476): [#def644]
ddcutil-2.2.1/src/usb/usb_vcp.c:492: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_response
#  490|         parsed_response = calloc(1, sizeof(Parsed_Nontable_Vcp_Response));
#  491|         parsed_response->vcp_code = feature_code;
#  492|->       parsed_response->valid_response = true;
#  493|         parsed_response->supported_opcode = true;
#  494|         // parsed_response->cur_value = curval;

Error: CPPCHECK_WARNING (CWE-476): [#def645]
ddcutil-2.2.1/src/usb/usb_vcp.c:493: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_response
#  491|         parsed_response->vcp_code = feature_code;
#  492|         parsed_response->valid_response = true;
#  493|->       parsed_response->supported_opcode = true;
#  494|         // parsed_response->cur_value = curval;
#  495|         // parsed_response->max_value = maxval;

Error: CPPCHECK_WARNING (CWE-476): [#def646]
ddcutil-2.2.1/src/usb/usb_vcp.c:496: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_response
#  494|         // parsed_response->cur_value = curval;
#  495|         // parsed_response->max_value = maxval;
#  496|->       parsed_response->mh = (maxval >> 8) & 0xff;
#  497|         parsed_response->ml = maxval & 0xff;
#  498|         parsed_response->sh = (curval >> 8) & 0xff;

Error: CPPCHECK_WARNING (CWE-476): [#def647]
ddcutil-2.2.1/src/usb/usb_vcp.c:497: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_response
#  495|         // parsed_response->max_value = maxval;
#  496|         parsed_response->mh = (maxval >> 8) & 0xff;
#  497|->       parsed_response->ml = maxval & 0xff;
#  498|         parsed_response->sh = (curval >> 8) & 0xff;
#  499|         parsed_response->sl = curval & 0xff;

Error: CPPCHECK_WARNING (CWE-476): [#def648]
ddcutil-2.2.1/src/usb/usb_vcp.c:498: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_response
#  496|         parsed_response->mh = (maxval >> 8) & 0xff;
#  497|         parsed_response->ml = maxval & 0xff;
#  498|->       parsed_response->sh = (curval >> 8) & 0xff;
#  499|         parsed_response->sl = curval & 0xff;
#  500|      }

Error: CPPCHECK_WARNING (CWE-476): [#def649]
ddcutil-2.2.1/src/usb/usb_vcp.c:499: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_response
#  497|         parsed_response->ml = maxval & 0xff;
#  498|         parsed_response->sh = (curval >> 8) & 0xff;
#  499|->       parsed_response->sl = curval & 0xff;
#  500|      }
#  501|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def650]
ddcutil-2.2.1/src/usb/usb_vcp.c:502:4: warning[-Wanalyzer-malloc-leak]: leak of 'parsed_response'
ddcutil-2.2.1/src/usb/usb_vcp.c:425:1: enter_function: entry to 'usb_get_nontable_vcp_value'
ddcutil-2.2.1/src/usb/usb_vcp.c:434:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_vcp.c:444:33: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_vcp.c:445:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb/usb_vcp.c:447:10: branch_false: ...to here
ddcutil-2.2.1/src/usb/usb_vcp.c:453:13: call_function: calling 'usb_get_usage_value_by_report_type_and_ucode' from 'usb_get_nontable_vcp_value'
ddcutil-2.2.1/src/usb/usb_vcp.c:453:13: return_function: returning to 'usb_get_nontable_vcp_value' from 'usb_get_usage_value_by_report_type_and_ucode'
ddcutil-2.2.1/src/usb/usb_vcp.c:490:25: acquire_memory: allocated here
ddcutil-2.2.1/src/usb/usb_vcp.c:502:4: danger: 'parsed_response' leaks here; was allocated at [(11)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/10)
#  500|      }
#  501|   
#  502|->    DBGTRC(debug, TRACE_GROUP,
#  503|                "Returning %s, *ppinterpreted_code=%p", psc_desc(psc), parsed_response);
#  504|      *ppInterpretedCode = parsed_response;

Error: CPPCHECK_WARNING (CWE-476): [#def651]
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:244: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur
#  242|   
#  243|         Byte b0 = b[i] & 0x03;                  // first 2 bits are size indicator, 0, 1, 2, or 3
#  244|->       cur->bsize_bytect = (b0 == 3) ? 4 : b0; // actual number of bytes
#  245|         cur->btype = (b[i] & (0x03 << 2))>>2;   // next 2 bits are type, shift to range 0..3
#  246|         cur->btag = b[i] & ~0x03;               // mask out size bits to get tag

Error: GCC_ANALYZER_WARNING (CWE-476): [#def652]
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:244:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur'
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:240:16: branch_true: following 'true' branch (when 'i < l')...
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:241:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:241:13: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:244:7: danger: 'cur' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  242|   
#  243|         Byte b0 = b[i] & 0x03;                  // first 2 bits are size indicator, 0, 1, 2, or 3
#  244|->       cur->bsize_bytect = (b0 == 3) ? 4 : b0; // actual number of bytes
#  245|         cur->btype = (b[i] & (0x03 << 2))>>2;   // next 2 bits are type, shift to range 0..3
#  246|         cur->btag = b[i] & ~0x03;               // mask out size bits to get tag

Error: CPPCHECK_WARNING (CWE-476): [#def653]
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:245: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur
#  243|         Byte b0 = b[i] & 0x03;                  // first 2 bits are size indicator, 0, 1, 2, or 3
#  244|         cur->bsize_bytect = (b0 == 3) ? 4 : b0; // actual number of bytes
#  245|->       cur->btype = (b[i] & (0x03 << 2))>>2;   // next 2 bits are type, shift to range 0..3
#  246|         cur->btag = b[i] & ~0x03;               // mask out size bits to get tag
#  247|         memcpy(cur->raw_bytes, b+i, 1+cur->bsize_bytect);

Error: CPPCHECK_WARNING (CWE-476): [#def654]
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:246: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur
#  244|         cur->bsize_bytect = (b0 == 3) ? 4 : b0; // actual number of bytes
#  245|         cur->btype = (b[i] & (0x03 << 2))>>2;   // next 2 bits are type, shift to range 0..3
#  246|->       cur->btag = b[i] & ~0x03;               // mask out size bits to get tag
#  247|         memcpy(cur->raw_bytes, b+i, 1+cur->bsize_bytect);
#  248|         // WRONG: printf("(%s) raw_bytes: 0x%0*x\n", __func__, (1+cur->bsize_bytect)*2, cur->raw_bytes);

Error: CPPCHECK_WARNING (CWE-476): [#def655]
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:247: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur
#  245|         cur->btype = (b[i] & (0x03 << 2))>>2;   // next 2 bits are type, shift to range 0..3
#  246|         cur->btag = b[i] & ~0x03;               // mask out size bits to get tag
#  247|->       memcpy(cur->raw_bytes, b+i, 1+cur->bsize_bytect);
#  248|         // WRONG: printf("(%s) raw_bytes: 0x%0*x\n", __func__, (1+cur->bsize_bytect)*2, cur->raw_bytes);
#  249|   

Error: CPPCHECK_WARNING (CWE-476): [#def656]
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:250: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur
#  248|         // WRONG: printf("(%s) raw_bytes: 0x%0*x\n", __func__, (1+cur->bsize_bytect)*2, cur->raw_bytes);
#  249|   
#  250|->       if (cur->bsize_bytect > 0) {
#  251|            cur->data = 0;
#  252|            for (j = 0; j < cur->bsize_bytect; j++) {

Error: CPPCHECK_WARNING (CWE-476): [#def657]
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:259: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur
#  257|         // alt:
#  258|         int kk = i+1;
#  259|->       switch(cur->bsize_bytect) {
#  260|   
#  261|         case 4:

Error: GCC_ANALYZER_WARNING (CWE-835): [#def658]
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:452:11: warning[-Wanalyzer-infinite-loop]: infinite loop
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:452:11: danger: infinite loop here
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:452:11: branch_true: when 'report_item_list' is non-NULL: always following 'true' branch...
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:453:11: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/base_hid_report_descriptor.c:453:10: branch_false: if it ever follows 'false' branch, it will always do so...
 branch_false: ...to here
#  450|   
#  451|      // We cheat on the spec. Just look at the first Usage Page item, is it USB Monitor?
#  452|->    while (cur_item) {
#  453|         if (cur_item->btag == 0x04) {
#  454|            if (cur_item->data == 0x80) {

Error: CPPCHECK_WARNING (CWE-476): [#def659]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:480: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  478|         }
#  479|         result = calloc(1, sizeof(Parsed_Hid_Report));
#  480|->       result->report_id = report_id;
#  481|         result->report_type = report_type;
#  482|         g_ptr_array_add(hc->reports, result);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def660]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:480:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:476:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:479:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:479:16: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:480:7: danger: 'result' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  478|         }
#  479|         result = calloc(1, sizeof(Parsed_Hid_Report));
#  480|->       result->report_id = report_id;
#  481|         result->report_type = report_type;
#  482|         g_ptr_array_add(hc->reports, result);

Error: CPPCHECK_WARNING (CWE-476): [#def661]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:481: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  479|         result = calloc(1, sizeof(Parsed_Hid_Report));
#  480|         result->report_id = report_id;
#  481|->       result->report_type = report_type;
#  482|         g_ptr_array_add(hc->reports, result);
#  483|      }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def662]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:482:7: warning[-Wanalyzer-malloc-leak]: leak of 'collection_stack[0]'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:625:41: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
#  480|         result->report_id = report_id;
#  481|         result->report_type = report_type;
#  482|->       g_ptr_array_add(hc->reports, result);
#  483|      }
#  484|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def663]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:482:7: warning[-Wanalyzer-malloc-leak]: leak of 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
#  480|         result->report_id = report_id;
#  481|         result->report_type = report_type;
#  482|->       g_ptr_array_add(hc->reports, result);
#  483|      }
#  484|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def664]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:482:7: warning[-Wanalyzer-malloc-leak]: leak of 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:822:24: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
#  480|         result->report_id = report_id;
#  481|         result->report_type = report_type;
#  482|->       g_ptr_array_add(hc->reports, result);
#  483|      }
#  484|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def665]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:482:7: warning[-Wanalyzer-malloc-leak]: leak of 'hf'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:692:37: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
#  480|         result->report_id = report_id;
#  481|         result->report_type = report_type;
#  482|->       g_ptr_array_add(hc->reports, result);
#  483|      }
#  484|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def666]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:482:7: warning[-Wanalyzer-malloc-leak]: leak of 'parsed_descriptor'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:624:48: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
#  480|         result->report_id = report_id;
#  481|         result->report_type = report_type;
#  482|->       g_ptr_array_add(hc->reports, result);
#  483|      }
#  484|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def667]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:482:7: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:476:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:479:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:479:16: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:482:7: danger: 'result' leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#  480|         result->report_id = report_id;
#  481|         result->report_type = report_type;
#  482|->       g_ptr_array_add(hc->reports, result);
#  483|      }
#  484|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def668]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:492:24: warning[-Wanalyzer-malloc-leak]: leak of 'collection_stack[0]'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:625:41: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'find_hid_report_or_new'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:705:13: call_function: calling 'add_report_field' from 'parse_hid_report_desc_from_item_list'
#  490|      assert(hr && hf);
#  491|      if (!hr->hid_fields)
#  492|->       hr->hid_fields = g_ptr_array_new();
#  493|      g_ptr_array_add(hr->hid_fields, hf);
#  494|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def669]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:492:24: warning[-Wanalyzer-malloc-leak]: leak of 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'find_hid_report_or_new'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:705:13: call_function: calling 'add_report_field' from 'parse_hid_report_desc_from_item_list'
#  490|      assert(hr && hf);
#  491|      if (!hr->hid_fields)
#  492|->       hr->hid_fields = g_ptr_array_new();
#  493|      g_ptr_array_add(hr->hid_fields, hf);
#  494|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def670]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:492:24: warning[-Wanalyzer-malloc-leak]: leak of 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:822:24: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'find_hid_report_or_new'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:705:13: call_function: calling 'add_report_field' from 'parse_hid_report_desc_from_item_list'
#  490|      assert(hr && hf);
#  491|      if (!hr->hid_fields)
#  492|->       hr->hid_fields = g_ptr_array_new();
#  493|      g_ptr_array_add(hr->hid_fields, hf);
#  494|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def671]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:492:24: warning[-Wanalyzer-malloc-leak]: leak of 'hf'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:692:37: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'find_hid_report_or_new'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:705:13: call_function: calling 'add_report_field' from 'parse_hid_report_desc_from_item_list'
#  490|      assert(hr && hf);
#  491|      if (!hr->hid_fields)
#  492|->       hr->hid_fields = g_ptr_array_new();
#  493|      g_ptr_array_add(hr->hid_fields, hf);
#  494|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def672]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:492:24: warning[-Wanalyzer-malloc-leak]: leak of 'parsed_descriptor'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:624:48: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'find_hid_report_or_new'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:705:13: call_function: calling 'add_report_field' from 'parse_hid_report_desc_from_item_list'
#  490|      assert(hr && hf);
#  491|      if (!hr->hid_fields)
#  492|->       hr->hid_fields = g_ptr_array_new();
#  493|      g_ptr_array_add(hr->hid_fields, hf);
#  494|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def673]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:493:4: warning[-Wanalyzer-malloc-leak]: leak of 'collection_stack[0]'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:625:41: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'find_hid_report_or_new'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:705:13: call_function: calling 'add_report_field' from 'parse_hid_report_desc_from_item_list'
#  491|      if (!hr->hid_fields)
#  492|         hr->hid_fields = g_ptr_array_new();
#  493|->    g_ptr_array_add(hr->hid_fields, hf);
#  494|   }
#  495|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def674]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:493:4: warning[-Wanalyzer-malloc-leak]: leak of 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'find_hid_report_or_new'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:705:13: call_function: calling 'add_report_field' from 'parse_hid_report_desc_from_item_list'
#  491|      if (!hr->hid_fields)
#  492|         hr->hid_fields = g_ptr_array_new();
#  493|->    g_ptr_array_add(hr->hid_fields, hf);
#  494|   }
#  495|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def675]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:493:4: warning[-Wanalyzer-malloc-leak]: leak of 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:822:24: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'find_hid_report_or_new'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:705:13: call_function: calling 'add_report_field' from 'parse_hid_report_desc_from_item_list'
#  491|      if (!hr->hid_fields)
#  492|         hr->hid_fields = g_ptr_array_new();
#  493|->    g_ptr_array_add(hr->hid_fields, hf);
#  494|   }
#  495|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def676]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:493:4: warning[-Wanalyzer-malloc-leak]: leak of 'hf'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:692:37: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'find_hid_report_or_new'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:705:13: call_function: calling 'add_report_field' from 'parse_hid_report_desc_from_item_list'
#  491|      if (!hr->hid_fields)
#  492|         hr->hid_fields = g_ptr_array_new();
#  493|->    g_ptr_array_add(hr->hid_fields, hf);
#  494|   }
#  495|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def677]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:493:4: warning[-Wanalyzer-malloc-leak]: leak of 'parsed_descriptor'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:624:48: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'find_hid_report_or_new'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:705:13: call_function: calling 'add_report_field' from 'parse_hid_report_desc_from_item_list'
#  491|      if (!hr->hid_fields)
#  492|         hr->hid_fields = g_ptr_array_new();
#  493|->    g_ptr_array_add(hr->hid_fields, hf);
#  494|   }
#  495|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def678]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:499:35: warning[-Wanalyzer-malloc-leak]: leak of 'collection_stack[0]'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:625:41: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
#  497|   void add_hid_collection_child(Parsed_Hid_Collection * parent, Parsed_Hid_Collection * new_child) {
#  498|      if (!parent->child_collections)
#  499|->       parent->child_collections = g_ptr_array_new();
#  500|      g_ptr_array_add(parent->child_collections, new_child);
#  501|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def679]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:499:35: warning[-Wanalyzer-malloc-leak]: leak of 'collection_stack[collection_stack_cur]'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:625:41: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
#  497|   void add_hid_collection_child(Parsed_Hid_Collection * parent, Parsed_Hid_Collection * new_child) {
#  498|      if (!parent->child_collections)
#  499|->       parent->child_collections = g_ptr_array_new();
#  500|      g_ptr_array_add(parent->child_collections, new_child);
#  501|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def680]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:499:35: warning[-Wanalyzer-malloc-leak]: leak of 'cur_collection'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:656:30: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
#  497|   void add_hid_collection_child(Parsed_Hid_Collection * parent, Parsed_Hid_Collection * new_child) {
#  498|      if (!parent->child_collections)
#  499|->       parent->child_collections = g_ptr_array_new();
#  500|      g_ptr_array_add(parent->child_collections, new_child);
#  501|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def681]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:499:35: warning[-Wanalyzer-malloc-leak]: leak of 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
#  497|   void add_hid_collection_child(Parsed_Hid_Collection * parent, Parsed_Hid_Collection * new_child) {
#  498|      if (!parent->child_collections)
#  499|->       parent->child_collections = g_ptr_array_new();
#  500|      g_ptr_array_add(parent->child_collections, new_child);
#  501|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def682]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:499:35: warning[-Wanalyzer-malloc-leak]: leak of 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
#  497|   void add_hid_collection_child(Parsed_Hid_Collection * parent, Parsed_Hid_Collection * new_child) {
#  498|      if (!parent->child_collections)
#  499|->       parent->child_collections = g_ptr_array_new();
#  500|      g_ptr_array_add(parent->child_collections, new_child);
#  501|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def683]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:499:35: warning[-Wanalyzer-malloc-leak]: leak of 'parsed_descriptor'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:624:48: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
#  497|   void add_hid_collection_child(Parsed_Hid_Collection * parent, Parsed_Hid_Collection * new_child) {
#  498|      if (!parent->child_collections)
#  499|->       parent->child_collections = g_ptr_array_new();
#  500|      g_ptr_array_add(parent->child_collections, new_child);
#  501|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def684]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:500:4: warning[-Wanalyzer-malloc-leak]: leak of 'collection_stack[0]'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:625:41: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
#  498|      if (!parent->child_collections)
#  499|         parent->child_collections = g_ptr_array_new();
#  500|->    g_ptr_array_add(parent->child_collections, new_child);
#  501|   }
#  502|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def685]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:500:4: warning[-Wanalyzer-malloc-leak]: leak of 'collection_stack[collection_stack_cur]'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:625:41: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
#  498|      if (!parent->child_collections)
#  499|         parent->child_collections = g_ptr_array_new();
#  500|->    g_ptr_array_add(parent->child_collections, new_child);
#  501|   }
#  502|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def686]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:500:4: warning[-Wanalyzer-malloc-leak]: leak of 'cur_collection'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:656:30: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
#  498|      if (!parent->child_collections)
#  499|         parent->child_collections = g_ptr_array_new();
#  500|->    g_ptr_array_add(parent->child_collections, new_child);
#  501|   }
#  502|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def687]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:500:4: warning[-Wanalyzer-malloc-leak]: leak of 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
#  498|      if (!parent->child_collections)
#  499|         parent->child_collections = g_ptr_array_new();
#  500|->    g_ptr_array_add(parent->child_collections, new_child);
#  501|   }
#  502|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def688]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:500:4: warning[-Wanalyzer-malloc-leak]: leak of 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
#  498|      if (!parent->child_collections)
#  499|         parent->child_collections = g_ptr_array_new();
#  500|->    g_ptr_array_add(parent->child_collections, new_child);
#  501|   }
#  502|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def689]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:500:4: warning[-Wanalyzer-malloc-leak]: leak of 'parsed_descriptor'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:624:48: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
#  498|      if (!parent->child_collections)
#  499|         parent->child_collections = g_ptr_array_new();
#  500|->    g_ptr_array_add(parent->child_collections, new_child);
#  501|   }
#  502|   

Error: CPPCHECK_WARNING (CWE-476): [#def690]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:625: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_descriptor
#  623|   
#  624|      Parsed_Hid_Descriptor * parsed_descriptor = calloc(1, sizeof(Parsed_Hid_Descriptor));
#  625|->    parsed_descriptor->root_collection = calloc(1,sizeof(Parsed_Hid_Collection));
#  626|      parsed_descriptor->root_collection->is_root_collection = true;
#  627|      parsed_descriptor->valid_descriptor = true;   // set false if invalid, should never occur

Error: GCC_ANALYZER_WARNING (CWE-476): [#def691]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:625:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'parsed_descriptor'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:624:48: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:625:4: danger: 'parsed_descriptor' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/33/codeFlows/0/threadFlows/0/locations/0)
#  623|   
#  624|      Parsed_Hid_Descriptor * parsed_descriptor = calloc(1, sizeof(Parsed_Hid_Descriptor));
#  625|->    parsed_descriptor->root_collection = calloc(1,sizeof(Parsed_Hid_Collection));
#  626|      parsed_descriptor->root_collection->is_root_collection = true;
#  627|      parsed_descriptor->valid_descriptor = true;   // set false if invalid, should never occur

Error: CPPCHECK_WARNING (CWE-476): [#def692]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:626: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_descriptor
#  624|      Parsed_Hid_Descriptor * parsed_descriptor = calloc(1, sizeof(Parsed_Hid_Descriptor));
#  625|      parsed_descriptor->root_collection = calloc(1,sizeof(Parsed_Hid_Collection));
#  626|->    parsed_descriptor->root_collection->is_root_collection = true;
#  627|      parsed_descriptor->valid_descriptor = true;   // set false if invalid, should never occur
#  628|   

Error: CPPCHECK_WARNING (CWE-476): [#def693]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:626: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_descriptor->root_collection
#  624|      Parsed_Hid_Descriptor * parsed_descriptor = calloc(1, sizeof(Parsed_Hid_Descriptor));
#  625|      parsed_descriptor->root_collection = calloc(1,sizeof(Parsed_Hid_Collection));
#  626|->    parsed_descriptor->root_collection->is_root_collection = true;
#  627|      parsed_descriptor->valid_descriptor = true;   // set false if invalid, should never occur
#  628|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def694]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:626:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'calloc(1, 32)'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:625:41: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:626:4: danger: 'calloc(1, 32)' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/34/codeFlows/0/threadFlows/0/locations/0)
#  624|      Parsed_Hid_Descriptor * parsed_descriptor = calloc(1, sizeof(Parsed_Hid_Descriptor));
#  625|      parsed_descriptor->root_collection = calloc(1,sizeof(Parsed_Hid_Collection));
#  626|->    parsed_descriptor->root_collection->is_root_collection = true;
#  627|      parsed_descriptor->valid_descriptor = true;   // set false if invalid, should never occur
#  628|   

Error: CPPCHECK_WARNING (CWE-476): [#def695]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:627: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_descriptor
#  625|      parsed_descriptor->root_collection = calloc(1,sizeof(Parsed_Hid_Collection));
#  626|      parsed_descriptor->root_collection->is_root_collection = true;
#  627|->    parsed_descriptor->valid_descriptor = true;   // set false if invalid, should never occur
#  628|   
#  629|   #define COLLECTION_STACK_SIZE 10

Error: CPPCHECK_WARNING (CWE-476): [#def696]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:631: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_descriptor
#  629|   #define COLLECTION_STACK_SIZE 10
#  630|      Parsed_Hid_Collection * collection_stack[COLLECTION_STACK_SIZE];
#  631|->    collection_stack[0] = parsed_descriptor->root_collection;
#  632|      int collection_stack_cur = 0;
#  633|   

Error: CPPCHECK_WARNING (CWE-476): [#def697]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:657: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur_collection
#  655|            {
#  656|               cur_collection = calloc(1, sizeof(Parsed_Hid_Collection));
#  657|->             cur_collection->collection_type = item->data;
#  658|               cur_collection->usage_page = cur_globals->usage_page;
#  659|               uint32_t cur_usage = 0;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def698]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:657:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_collection'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:656:30: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:657:13: danger: 'cur_collection' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/35/codeFlows/0/threadFlows/0/locations/6)
#  655|            {
#  656|               cur_collection = calloc(1, sizeof(Parsed_Hid_Collection));
#  657|->             cur_collection->collection_type = item->data;
#  658|               cur_collection->usage_page = cur_globals->usage_page;
#  659|               uint32_t cur_usage = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def699]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:658: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur_collection
#  656|               cur_collection = calloc(1, sizeof(Parsed_Hid_Collection));
#  657|               cur_collection->collection_type = item->data;
#  658|->             cur_collection->usage_page = cur_globals->usage_page;
#  659|               uint32_t cur_usage = 0;
#  660|               if (cur_locals->usages && cur_locals->usages->len > 0) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def700]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:658:42: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:658:42: danger: 'cur_globals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/36/codeFlows/0/threadFlows/0/locations/0)
#  656|               cur_collection = calloc(1, sizeof(Parsed_Hid_Collection));
#  657|               cur_collection->collection_type = item->data;
#  658|->             cur_collection->usage_page = cur_globals->usage_page;
#  659|               uint32_t cur_usage = 0;
#  660|               if (cur_locals->usages && cur_locals->usages->len > 0) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def701]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:17: danger: 'cur_locals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/37/codeFlows/0/threadFlows/0/locations/0)
#  658|               cur_collection->usage_page = cur_globals->usage_page;
#  659|               uint32_t cur_usage = 0;
#  660|->             if (cur_locals->usages && cur_locals->usages->len > 0) {
#  661|                  cur_usage = g_array_index(cur_locals->usages, uint32_t, 0);
#  662|                  // cur_collection->usage_id = cur_usage;    // deprecated

Error: CPPCHECK_WARNING (CWE-476): [#def702]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:679: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur_collection
#  677|               }
#  678|   
#  679|->             cur_collection->reports = g_ptr_array_new();
#  680|   
#  681|               // add this collection as a child of the parent collection

Error: GCC_ANALYZER_WARNING (CWE-401): [#def703]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:679:39: warning[-Wanalyzer-malloc-leak]: leak of 'collection_stack[0]'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:625:41: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:679:39: danger: 'collection_stack[0]' leaks here; was allocated at [(2)](sarif:/runs/0/results/44/codeFlows/0/threadFlows/0/locations/1)
#  677|               }
#  678|   
#  679|->             cur_collection->reports = g_ptr_array_new();
#  680|   
#  681|               // add this collection as a child of the parent collection

Error: GCC_ANALYZER_WARNING (CWE-401): [#def704]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:679:39: warning[-Wanalyzer-malloc-leak]: leak of 'collection_stack[collection_stack_cur]'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:625:41: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:679:39: danger: 'collection_stack[collection_stack_cur]' leaks here; was allocated at [(1)](sarif:/runs/0/results/38/codeFlows/0/threadFlows/0/locations/0)
#  677|               }
#  678|   
#  679|->             cur_collection->reports = g_ptr_array_new();
#  680|   
#  681|               // add this collection as a child of the parent collection

Error: GCC_ANALYZER_WARNING (CWE-401): [#def705]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:679:39: warning[-Wanalyzer-malloc-leak]: leak of 'cur_collection'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:656:30: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:679:39: danger: 'cur_collection' leaks here; was allocated at [(7)](sarif:/runs/0/results/42/codeFlows/0/threadFlows/0/locations/6)
#  677|               }
#  678|   
#  679|->             cur_collection->reports = g_ptr_array_new();
#  680|   
#  681|               // add this collection as a child of the parent collection

Error: GCC_ANALYZER_WARNING (CWE-401): [#def706]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:679:39: warning[-Wanalyzer-malloc-leak]: leak of 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:679:39: danger: 'cur_globals' leaks here; was allocated at [(1)](sarif:/runs/0/results/41/codeFlows/0/threadFlows/0/locations/0)
#  677|               }
#  678|   
#  679|->             cur_collection->reports = g_ptr_array_new();
#  680|   
#  681|               // add this collection as a child of the parent collection

Error: GCC_ANALYZER_WARNING (CWE-401): [#def707]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:679:39: warning[-Wanalyzer-malloc-leak]: leak of 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:679:39: danger: 'cur_locals' leaks here; was allocated at [(1)](sarif:/runs/0/results/40/codeFlows/0/threadFlows/0/locations/0)
#  677|               }
#  678|   
#  679|->             cur_collection->reports = g_ptr_array_new();
#  680|   
#  681|               // add this collection as a child of the parent collection

Error: GCC_ANALYZER_WARNING (CWE-401): [#def708]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:679:39: warning[-Wanalyzer-malloc-leak]: leak of 'parsed_descriptor'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:624:48: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:679:39: danger: 'parsed_descriptor' leaks here; was allocated at [(1)](sarif:/runs/0/results/39/codeFlows/0/threadFlows/0/locations/0)
#  677|               }
#  678|   
#  679|->             cur_collection->reports = g_ptr_array_new();
#  680|   
#  681|               // add this collection as a child of the parent collection

Error: CPPCHECK_WARNING (CWE-476): [#def709]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:697: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: hf
#  695|               else if (item->btag == 0x90) report_type = HID_REPORT_TYPE_OUTPUT;
#  696|               else                         report_type = HID_REPORT_TYPE_FEATURE;
#  697|->             hf->item_flags = item->data;
#  698|               uint16_t report_id = cur_globals->report_id;
#  699|               Parsed_Hid_Report * hr = find_hid_report_or_new(

Error: GCC_ANALYZER_WARNING (CWE-476): [#def710]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:697:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'hf'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:692:37: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:697:13: danger: 'hf' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/46/codeFlows/0/threadFlows/0/locations/6)
#  695|               else if (item->btag == 0x90) report_type = HID_REPORT_TYPE_OUTPUT;
#  696|               else                         report_type = HID_REPORT_TYPE_FEATURE;
#  697|->             hf->item_flags = item->data;
#  698|               uint16_t report_id = cur_globals->report_id;
#  699|               Parsed_Hid_Report * hr = find_hid_report_or_new(

Error: GCC_ANALYZER_WARNING (CWE-476): [#def711]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:698:22: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:698:22: danger: 'cur_globals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/47/codeFlows/0/threadFlows/0/locations/0)
#  696|               else                         report_type = HID_REPORT_TYPE_FEATURE;
#  697|               hf->item_flags = item->data;
#  698|->             uint16_t report_id = cur_globals->report_id;
#  699|               Parsed_Hid_Report * hr = find_hid_report_or_new(
#  700|                        cur_collection,

Error: GCC_ANALYZER_WARNING (CWE-476): [#def712]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:734:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:660:16: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:665:16: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: call_function: calling 'add_hid_collection_child' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:682:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_hid_collection_child'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:683:13: branch_false: following 'false' branch (when 'collection_stack_cur <= 8')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:684:13: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: call_function: calling 'free_cur_report_locals' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:821:10: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'free_cur_report_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:822:24: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: call_function: calling 'find_hid_report_or_new' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:699:38: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'find_hid_report_or_new'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:705:13: call_function: calling 'add_report_field' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:705:13: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'add_report_field'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:734:20: danger: 'cur_locals' could be NULL: unchecked value from [(31)](sarif:/runs/0/results/48/codeFlows/0/threadFlows/0/locations/30)
#  732|   #endif
#  733|   
#  734|->             if ( ( cur_locals->usage_minimum && !cur_locals->usage_maximum) ||
#  735|                    (!cur_locals->usage_minimum &&  cur_locals->usage_maximum) )
#  736|               {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def713]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:830:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:830:15: danger: 'cur_globals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/49/codeFlows/0/threadFlows/0/locations/0)
#  828|            switch (item->btag) {
#  829|            case 0x04: /* Usage Page */
#  830|->               cur_globals->usage_page = item->data;
#  831|                 break;
#  832|            case 0x14:       // Logical Minimum

Error: GCC_ANALYZER_WARNING (CWE-476): [#def714]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:833:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:833:46: call_function: calling 'maybe_signed_data' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:833:46: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'maybe_signed_data'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:833:15: danger: 'cur_globals' could be NULL: unchecked value from [(2)](sarif:/runs/0/results/50/codeFlows/0/threadFlows/0/locations/1)
#  831|                 break;
#  832|            case 0x14:       // Logical Minimum
#  833|->               cur_globals->logical_minimum = maybe_signed_data(item->data, item->bsize_bytect);
#  834|                 break;
#  835|            case 0x24:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def715]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:836:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:836:46: call_function: calling 'maybe_signed_data' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:836:46: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'maybe_signed_data'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:836:15: danger: 'cur_globals' could be NULL: unchecked value from [(2)](sarif:/runs/0/results/51/codeFlows/0/threadFlows/0/locations/1)
#  834|                 break;
#  835|            case 0x24:
#  836|->               cur_globals->logical_maximum = maybe_signed_data(item->data, item->bsize_bytect);
#  837|                 break;
#  838|            case 0x34:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def716]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:839:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:839:47: call_function: calling 'maybe_signed_data' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:839:47: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'maybe_signed_data'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:839:15: danger: 'cur_globals' could be NULL: unchecked value from [(2)](sarif:/runs/0/results/52/codeFlows/0/threadFlows/0/locations/1)
#  837|                 break;
#  838|            case 0x34:
#  839|->               cur_globals->physical_minimum = maybe_signed_data(item->data, item->bsize_bytect);
#  840|                 break;
#  841|            case 0x44:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def717]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:842:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:613:25: enter_function: entry to 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:842:47: call_function: calling 'maybe_signed_data' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:842:47: return_function: returning to 'parse_hid_report_desc_from_item_list' from 'maybe_signed_data'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:842:15: danger: 'cur_globals' could be NULL: unchecked value from [(2)](sarif:/runs/0/results/53/codeFlows/0/threadFlows/0/locations/1)
#  840|                 break;
#  841|            case 0x44:
#  842|->               cur_globals->physical_maximum = maybe_signed_data(item->data, item->bsize_bytect);;
#  843|                 break;
#  844|            case 0x54:     // Unit Exponent

Error: GCC_ANALYZER_WARNING (CWE-476): [#def718]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:845:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:845:15: danger: 'cur_globals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/54/codeFlows/0/threadFlows/0/locations/0)
#  843|                 break;
#  844|            case 0x54:     // Unit Exponent
#  845|->               cur_globals->unit_exponent = item->data;                     // Global
#  846|                 break;
#  847|            case 0x64:     // Unit

Error: GCC_ANALYZER_WARNING (CWE-476): [#def719]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:848:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:848:15: danger: 'cur_globals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/55/codeFlows/0/threadFlows/0/locations/0)
#  846|                 break;
#  847|            case 0x64:     // Unit
#  848|->               cur_globals->unit = item->data;      // ??                   // Global
#  849|                 break;
#  850|            case 0x74:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def720]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:851:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:851:15: danger: 'cur_globals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/56/codeFlows/0/threadFlows/0/locations/0)
#  849|                 break;
#  850|            case 0x74:
#  851|->               cur_globals->report_size = item->data;
#  852|                 break;
#  853|            case 0x84:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def721]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:854:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:854:15: danger: 'cur_globals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/57/codeFlows/0/threadFlows/0/locations/0)
#  852|                 break;
#  853|            case 0x84:
#  854|->               cur_globals->report_id = item->data;
#  855|                 break;
#  856|            case 0x94:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def722]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:857:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:857:15: danger: 'cur_globals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/58/codeFlows/0/threadFlows/0/locations/0)
#  855|                 break;
#  856|            case 0x94:
#  857|->               cur_globals->report_count = item->data;
#  858|                 break;
#  859|            case 0xa4:      // Push

Error: CPPCHECK_WARNING (CWE-476): [#def723]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:863: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cur_globals
#  861|                 Cur_Report_Globals* old_globals = cur_globals;
#  862|                 cur_globals = calloc(1, sizeof(Cur_Report_Globals));
#  863|->               cur_globals->prev = old_globals;
#  864|                 break;
#  865|            }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def724]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:863:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:862:29: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:863:15: danger: 'cur_globals' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/59/codeFlows/0/threadFlows/0/locations/6)
#  861|                 Cur_Report_Globals* old_globals = cur_globals;
#  862|                 cur_globals = calloc(1, sizeof(Cur_Report_Globals));
#  863|->               cur_globals->prev = old_globals;
#  864|                 break;
#  865|            }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def725]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:867:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:867:20: danger: 'cur_globals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/60/codeFlows/0/threadFlows/0/locations/0)
#  865|            }
#  866|            case 0xb4:     // Pop
#  867|->               if (!cur_globals->prev) {
#  868|                    printf("(%s) Invalid item Pop without previous Push\n", __func__);
#  869|                 }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def726]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:893:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:893:19: danger: 'cur_locals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/61/codeFlows/0/threadFlows/0/locations/0)
#  891|                           __func__, item->bsize_bytect, item->data, item->data);
#  892|   
#  893|->               if (cur_locals->usages == NULL)
#  894|                    cur_locals->usages = g_array_new(
#  895|                          /* null terminated */ false,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def727]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:894:39: warning[-Wanalyzer-malloc-leak]: leak of 'collection_stack[0]'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:981:25: enter_function: entry to 'parse_hid_report_desc'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:988:37: call_function: calling 'parse_hid_report_desc_from_item_list' from 'parse_hid_report_desc'
#  892|   
#  893|                 if (cur_locals->usages == NULL)
#  894|->                  cur_locals->usages = g_array_new(
#  895|                          /* null terminated */ false,
#  896|                          /* init to 0       */ true,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def728]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:894:39: warning[-Wanalyzer-malloc-leak]: leak of 'collection_stack[collection_stack_cur]'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:625:41: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:893:18: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:894:39: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:894:39: danger: 'collection_stack[collection_stack_cur]' leaks here; was allocated at [(1)](sarif:/runs/0/results/62/codeFlows/0/threadFlows/0/locations/0)
#  892|   
#  893|                 if (cur_locals->usages == NULL)
#  894|->                  cur_locals->usages = g_array_new(
#  895|                          /* null terminated */ false,
#  896|                          /* init to 0       */ true,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def729]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:894:39: warning[-Wanalyzer-malloc-leak]: leak of 'cur_globals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:620:39: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:893:18: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:894:39: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:894:39: danger: 'cur_globals' leaks here; was allocated at [(1)](sarif:/runs/0/results/63/codeFlows/0/threadFlows/0/locations/0)
#  892|   
#  893|                 if (cur_locals->usages == NULL)
#  894|->                  cur_locals->usages = g_array_new(
#  895|                          /* null terminated */ false,
#  896|                          /* init to 0       */ true,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def730]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:894:39: warning[-Wanalyzer-malloc-leak]: leak of 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:893:18: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:894:39: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:894:39: danger: 'cur_locals' leaks here; was allocated at [(1)](sarif:/runs/0/results/64/codeFlows/0/threadFlows/0/locations/0)
#  892|   
#  893|                 if (cur_locals->usages == NULL)
#  894|->                  cur_locals->usages = g_array_new(
#  895|                          /* null terminated */ false,
#  896|                          /* init to 0       */ true,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def731]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:894:39: warning[-Wanalyzer-malloc-leak]: leak of 'parsed_descriptor'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:624:48: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:893:18: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:894:39: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:894:39: danger: 'parsed_descriptor' leaks here; was allocated at [(1)](sarif:/runs/0/results/65/codeFlows/0/threadFlows/0/locations/0)
#  892|   
#  893|                 if (cur_locals->usages == NULL)
#  894|->                  cur_locals->usages = g_array_new(
#  895|                          /* null terminated */ false,
#  896|                          /* init to 0       */ true,

Error: GCC_ANALYZER_WARNING (CWE-476): [#def732]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:918:14: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:918:14: danger: 'cur_locals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/69/codeFlows/0/threadFlows/0/locations/0)
#  916|              }
#  917|              case 0x18:     // Usage minimum
#  918|->              cur_locals->usage_minimum = item->data;
#  919|                break;
#  920|              case 0x28:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def733]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:921:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:921:15: danger: 'cur_locals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/70/codeFlows/0/threadFlows/0/locations/0)
#  919|                break;
#  920|              case 0x28:
#  921|->               cur_locals->usage_maximum = item->data;
#  922|                 break;
#  923|              case 0x38:    // designator index

Error: GCC_ANALYZER_WARNING (CWE-476): [#def734]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:928:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:928:15: danger: 'cur_locals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/71/codeFlows/0/threadFlows/0/locations/0)
#  926|                 break;
#  927|              case 0x48:
#  928|->               cur_locals->designator_minimum = item->data;
#  929|                 break;
#  930|              case 0x58:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def735]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:931:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:931:15: danger: 'cur_locals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/72/codeFlows/0/threadFlows/0/locations/0)
#  929|                 break;
#  930|              case 0x58:
#  931|->               cur_locals->designator_maximum = item->data;
#  932|                 break;
#  933|              case 0x78:           // string index

Error: GCC_ANALYZER_WARNING (CWE-476): [#def736]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:938:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:938:15: danger: 'cur_locals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/73/codeFlows/0/threadFlows/0/locations/0)
#  936|                 break;
#  937|              case 0x88:
#  938|->               cur_locals->string_minimum = item->data;
#  939|                 break;
#  940|              case 0x98:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def737]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:941:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'cur_locals'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:621:39: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:635:10: branch_true: following 'true' branch (when 'item' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:647:15: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:941:15: danger: 'cur_locals' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/74/codeFlows/0/threadFlows/0/locations/0)
#  939|                 break;
#  940|              case 0x98:
#  941|->               cur_locals->string_maximum = item->data;
#  942|                 break;
#  943|              case 0xa8:     // delimiter - defines beginning or end of set of local items

Error: GCC_ANALYZER_WARNING (CWE-401): [#def738]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:989:4: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:981:25: enter_function: entry to 'parse_hid_report_desc'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:988:37: call_function: calling 'parse_hid_report_desc_from_item_list' from 'parse_hid_report_desc'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:988:37: return_function: returning to 'parse_hid_report_desc' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:989:4: danger: '<unknown>' leaks here; was allocated at [(4)](sarif:/runs/0/results/76/codeFlows/0/threadFlows/0/locations/3)
#  987|   
#  988|      Parsed_Hid_Descriptor * result = parse_hid_report_desc_from_item_list(item_list);
#  989|->    free_hid_report_item_list(item_list);
#  990|      return result;
#  991|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def739]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:989:4: warning[-Wanalyzer-malloc-leak]: leak of 'parse_hid_report_desc_from_item_list(tokenize_hid_report_descriptor(b,  desclen))'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:981:25: enter_function: entry to 'parse_hid_report_desc'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:988:37: call_function: calling 'parse_hid_report_desc_from_item_list' from 'parse_hid_report_desc'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:988:37: return_function: returning to 'parse_hid_report_desc' from 'parse_hid_report_desc_from_item_list'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:989:4: danger: 'parse_hid_report_desc_from_item_list(tokenize_hid_report_descriptor(b,  desclen))' leaks here; was allocated at [(4)](sarif:/runs/0/results/75/codeFlows/0/threadFlows/0/locations/3)
#  987|   
#  988|      Parsed_Hid_Descriptor * result = parse_hid_report_desc_from_item_list(item_list);
#  989|->    free_hid_report_item_list(item_list);
#  990|      return result;
#  991|   }

Error: CPPCHECK_WARNING (CWE-476): [#def740]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1169: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: code_rpt
# 1167|                        if (vcp_feature_code) {
# 1168|                           Vcp_Code_Report * code_rpt = calloc(1, sizeof(Vcp_Code_Report));
# 1169|->                         code_rpt->vcp_code = vcp_feature_code;
# 1170|                           code_rpt->rpt = rpt;
# 1171|                           g_ptr_array_add(vcp_reports, code_rpt);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def741]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1169:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'code_rpt'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1136:13: enter_function: entry to 'get_vcp_code_reports'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1143:34: call_function: calling 'get_monitor_application_collection' from 'get_vcp_code_reports'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1143:34: return_function: returning to 'get_vcp_code_reports' from 'get_monitor_application_collection'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1149:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1150:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1151:36: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1152:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1153:17: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1153:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1157:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1158:20: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1157:20: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1165:23: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1165:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1166:46: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1167:25: branch_true: following 'true' branch (when 'vcp_feature_code != 0')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1168:54: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1168:54: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1169:25: danger: 'code_rpt' could be NULL: unchecked value from [(23)](sarif:/runs/0/results/77/codeFlows/0/threadFlows/0/locations/22)
# 1167|                        if (vcp_feature_code) {
# 1168|                           Vcp_Code_Report * code_rpt = calloc(1, sizeof(Vcp_Code_Report));
# 1169|->                         code_rpt->vcp_code = vcp_feature_code;
# 1170|                           code_rpt->rpt = rpt;
# 1171|                           g_ptr_array_add(vcp_reports, code_rpt);

Error: CPPCHECK_WARNING (CWE-476): [#def742]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1170: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: code_rpt
# 1168|                           Vcp_Code_Report * code_rpt = calloc(1, sizeof(Vcp_Code_Report));
# 1169|                           code_rpt->vcp_code = vcp_feature_code;
# 1170|->                         code_rpt->rpt = rpt;
# 1171|                           g_ptr_array_add(vcp_reports, code_rpt);
# 1172|                        }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def743]
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1171:25: warning[-Wanalyzer-malloc-leak]: leak of 'code_rpt'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1136:13: enter_function: entry to 'get_vcp_code_reports'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1143:34: call_function: calling 'get_monitor_application_collection' from 'get_vcp_code_reports'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1143:34: return_function: returning to 'get_vcp_code_reports' from 'get_monitor_application_collection'
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1149:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1150:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1151:36: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1152:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1153:17: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1153:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1157:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1158:20: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1157:20: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1165:23: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1165:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1166:46: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1167:25: branch_true: following 'true' branch (when 'vcp_feature_code != 0')...
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1168:54: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1168:54: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/hid_report_descriptor.c:1171:25: danger: 'code_rpt' leaks here; was allocated at [(23)](sarif:/runs/0/results/78/codeFlows/0/threadFlows/0/locations/22)
# 1169|                           code_rpt->vcp_code = vcp_feature_code;
# 1170|                           code_rpt->rpt = rpt;
# 1171|->                         g_ptr_array_add(vcp_reports, code_rpt);
# 1172|                        }
# 1173|                        else {

Error: CPPCHECK_WARNING (CWE-476): [#def744]
ddcutil-2.2.1/src/usb_util/hiddev_reports.c:582: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
#  580|   
#  581|                        for (int ndx=0; ndx<finfo.maxusage; ndx++)
#  582|->                         buf[ndx] = uref_multi.values[ndx] & 0xff;
#  583|                        rpt_hex_dump(buf, finfo.maxusage, d2);
#  584|                        free(buf);

Error: CPPCHECK_WARNING (CWE-476): [#def745]
ddcutil-2.2.1/src/usb_util/hiddev_util.c:560: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  558|      if (is_matched) {
#  559|         result = malloc(sizeof(struct hiddev_field_info));
#  560|->       memcpy(result, &finfo, sizeof(struct hiddev_field_info));
#  561|      }
#  562|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def746]
ddcutil-2.2.1/src/usb_util/hiddev_util.c:560:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:519:7: branch_false: following 'false' branch (when 'rc == 0')...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:531:7: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:540:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:541:34: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:548:13: branch_false: following 'false' branch (when 'rc == 0')...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:552:14: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:558:7: branch_true: following 'true' branch (when 'is_matched != 0')...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:559:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:559:16: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hiddev_util.c:560:7: danger: 'result' could be NULL: unchecked value from [(9)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/8)
#  558|      if (is_matched) {
#  559|         result = malloc(sizeof(struct hiddev_field_info));
#  560|->       memcpy(result, &finfo, sizeof(struct hiddev_field_info));
#  561|      }
#  562|   

Error: CPPCHECK_WARNING (CWE-476): [#def747]
ddcutil-2.2.1/src/usb_util/hiddev_util.c:640: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  638|         // result->rinfo = calloc(1, sizeof(struct hiddev_report_info));
#  639|         // memcpy(result->rinfo, &rinfo, sizeof(struct hiddev_report_info));
#  640|->       result->finfo       = finfo_found;   // returned by is_field_edid() or test_field_ucode()
#  641|         result->report_type = rinfo.report_type;
#  642|         result->report_id   = report_id_found;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def748]
ddcutil-2.2.1/src/usb_util/hiddev_util.c:640:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:587:1: enter_function: entry to 'hiddev_find_report'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:605:11: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:609:7: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:611:10: branch_false: following 'false' branch (when 'reportinfo_rc == 0')...
 branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:617:26: branch_true: following 'true' branch (when 'field_index_found == -1')...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:620:24: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:620:24: call_function: calling 'test_field_ucode' from 'hiddev_find_report'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:620:24: return_function: returning to 'hiddev_find_report' from 'test_field_ucode'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:621:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:622:34: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:605:11: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:635:7: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:635:7: branch_true: following 'true' branch (when 'finfo_found' is non-NULL)...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:637:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:637:16: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/usb_util/hiddev_util.c:640:7: danger: 'result' could be NULL: unchecked value from [(21)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/20)
#  638|         // result->rinfo = calloc(1, sizeof(struct hiddev_report_info));
#  639|         // memcpy(result->rinfo, &rinfo, sizeof(struct hiddev_report_info));
#  640|->       result->finfo       = finfo_found;   // returned by is_field_edid() or test_field_ucode()
#  641|         result->report_type = rinfo.report_type;
#  642|         result->report_id   = report_id_found;

Error: CPPCHECK_WARNING (CWE-476): [#def749]
ddcutil-2.2.1/src/usb_util/hiddev_util.c:641: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  639|         // memcpy(result->rinfo, &rinfo, sizeof(struct hiddev_report_info));
#  640|         result->finfo       = finfo_found;   // returned by is_field_edid() or test_field_ucode()
#  641|->       result->report_type = rinfo.report_type;
#  642|         result->report_id   = report_id_found;
#  643|         result->field_index = field_index_found;    // finfo.field_index may have been changed by HIDIOGREPORTINFO

Error: CPPCHECK_WARNING (CWE-476): [#def750]
ddcutil-2.2.1/src/usb_util/hiddev_util.c:642: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  640|         result->finfo       = finfo_found;   // returned by is_field_edid() or test_field_ucode()
#  641|         result->report_type = rinfo.report_type;
#  642|->       result->report_id   = report_id_found;
#  643|         result->field_index = field_index_found;    // finfo.field_index may have been changed by HIDIOGREPORTINFO
#  644|      }

Error: CPPCHECK_WARNING (CWE-476): [#def751]
ddcutil-2.2.1/src/usb_util/hiddev_util.c:643: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  641|         result->report_type = rinfo.report_type;
#  642|         result->report_id   = report_id_found;
#  643|->       result->field_index = field_index_found;    // finfo.field_index may have been changed by HIDIOGREPORTINFO
#  644|      }
#  645|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def752]
ddcutil-2.2.1/src/usb_util/hiddev_util.c:746:10: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:906:10: enter_function: entry to 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: call_function: calling 'locate_edid_report' from 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: return_function: returning to 'hiddev_get_edid' from 'locate_edid_report'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:913:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: call_function: calling 'hiddev_get_multibyte_report_value_by_hid_field_locator' from 'hiddev_get_edid'
#  744|         }
#  745|         else
#  746|->          REPORT_USB_IOCTL_ERROR("HIDIOCGUSAGES", errno);
#  747|         goto bye;
#  748|      }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def753]
ddcutil-2.2.1/src/usb_util/hiddev_util.c:746:10: warning[-Wanalyzer-malloc-leak]: leak of 'locate_edid_report(fd)'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:906:10: enter_function: entry to 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: call_function: calling 'locate_edid_report' from 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: return_function: returning to 'hiddev_get_edid' from 'locate_edid_report'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:913:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: call_function: calling 'hiddev_get_multibyte_report_value_by_hid_field_locator' from 'hiddev_get_edid'
#  744|         }
#  745|         else
#  746|->          REPORT_USB_IOCTL_ERROR("HIDIOCGUSAGES", errno);
#  747|         goto bye;
#  748|      }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def754]
ddcutil-2.2.1/src/usb_util/hiddev_util.c:749:13: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:906:10: enter_function: entry to 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: call_function: calling 'locate_edid_report' from 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: return_function: returning to 'hiddev_get_edid' from 'locate_edid_report'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:913:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: call_function: calling 'hiddev_get_multibyte_report_value_by_hid_field_locator' from 'hiddev_get_edid'
#  747|         goto bye;
#  748|      }
#  749|->    result = buffer_new(uref_multi->num_values, __func__);
#  750|      for (int ndx=0; ndx<uref_multi->num_values; ndx++)
#  751|         buffer_add(result, uref_multi->values[ndx] & 0xff);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def755]
ddcutil-2.2.1/src/usb_util/hiddev_util.c:749:13: warning[-Wanalyzer-malloc-leak]: leak of 'locate_edid_report(fd)'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:906:10: enter_function: entry to 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: call_function: calling 'locate_edid_report' from 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: return_function: returning to 'hiddev_get_edid' from 'locate_edid_report'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:913:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: call_function: calling 'hiddev_get_multibyte_report_value_by_hid_field_locator' from 'hiddev_get_edid'
#  747|         goto bye;
#  748|      }
#  749|->    result = buffer_new(uref_multi->num_values, __func__);
#  750|      for (int ndx=0; ndx<uref_multi->num_values; ndx++)
#  751|         buffer_add(result, uref_multi->values[ndx] & 0xff);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def756]
ddcutil-2.2.1/src/usb_util/hiddev_util.c:751:7: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:906:10: enter_function: entry to 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: call_function: calling 'locate_edid_report' from 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: return_function: returning to 'hiddev_get_edid' from 'locate_edid_report'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:913:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: call_function: calling 'hiddev_get_multibyte_report_value_by_hid_field_locator' from 'hiddev_get_edid'
#  749|      result = buffer_new(uref_multi->num_values, __func__);
#  750|      for (int ndx=0; ndx<uref_multi->num_values; ndx++)
#  751|->       buffer_add(result, uref_multi->values[ndx] & 0xff);
#  752|   
#  753|   bye:

Error: GCC_ANALYZER_WARNING (CWE-401): [#def757]
ddcutil-2.2.1/src/usb_util/hiddev_util.c:751:7: warning[-Wanalyzer-malloc-leak]: leak of 'locate_edid_report(fd)'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:906:10: enter_function: entry to 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: call_function: calling 'locate_edid_report' from 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: return_function: returning to 'hiddev_get_edid' from 'locate_edid_report'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:913:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: call_function: calling 'hiddev_get_multibyte_report_value_by_hid_field_locator' from 'hiddev_get_edid'
#  749|      result = buffer_new(uref_multi->num_values, __func__);
#  750|      for (int ndx=0; ndx<uref_multi->num_values; ndx++)
#  751|->       buffer_add(result, uref_multi->values[ndx] & 0xff);
#  752|   
#  753|   bye:

Error: GCC_ANALYZER_WARNING (CWE-401): [#def758]
ddcutil-2.2.1/src/usb_util/hiddev_util.c:800:10: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:906:10: enter_function: entry to 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: call_function: calling 'locate_edid_report' from 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: return_function: returning to 'hiddev_get_edid' from 'locate_edid_report'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:913:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: call_function: calling 'hiddev_get_multibyte_report_value_by_hid_field_locator' from 'hiddev_get_edid'
#  798|         }
#  799|         else
#  800|->          REPORT_USB_IOCTL_ERROR("HIDIOCGREPORT", errno);
#  801|         goto bye;
#  802|      }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def759]
ddcutil-2.2.1/src/usb_util/hiddev_util.c:800:10: warning[-Wanalyzer-malloc-leak]: leak of 'locate_edid_report(fd)'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:906:10: enter_function: entry to 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: call_function: calling 'locate_edid_report' from 'hiddev_get_edid'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:912:37: return_function: returning to 'hiddev_get_edid' from 'locate_edid_report'
ddcutil-2.2.1/src/usb_util/hiddev_util.c:913:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/hiddev_util.c:914:16: call_function: calling 'hiddev_get_multibyte_report_value_by_hid_field_locator' from 'hiddev_get_edid'
#  798|         }
#  799|         else
#  800|->          REPORT_USB_IOCTL_ERROR("HIDIOCGREPORT", errno);
#  801|         goto bye;
#  802|      }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def760]
ddcutil-2.2.1/src/usb_util/libusb_util.c:254:16: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/usb_util/libusb_util.c:501:18: enter_function: entry to 'filter_possible_monitor_devs'
ddcutil-2.2.1/src/usb_util/libusb_util.c:511:30: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/libusb_util.c:515:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:516:31: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:527:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:531:7: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:537:23: call_function: calling 'possible_monitor_dev' from 'filter_possible_monitor_devs'
#  252|   
#  253|          Pci_Usb_Id_Names names;
#  254|->        names = devid_get_usb_names(
#  255|                          vid,
#  256|                          pid,

Error: GCC_ANALYZER_WARNING (CWE-401): [#def761]
ddcutil-2.2.1/src/usb_util/libusb_util.c:290:4: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/usb_util/libusb_util.c:501:18: enter_function: entry to 'filter_possible_monitor_devs'
ddcutil-2.2.1/src/usb_util/libusb_util.c:511:30: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/libusb_util.c:515:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:516:31: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:527:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:531:7: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:537:23: call_function: calling 'possible_monitor_dev' from 'filter_possible_monitor_devs'
#  288|   
#  289|      struct libusb_config_descriptor *config;
#  290|->    libusb_get_config_descriptor(dev, 0, &config);
#  291|   
#  292|      struct libusb_device_descriptor desc;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def762]
ddcutil-2.2.1/src/usb_util/libusb_util.c:294:14: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/usb_util/libusb_util.c:501:18: enter_function: entry to 'filter_possible_monitor_devs'
ddcutil-2.2.1/src/usb_util/libusb_util.c:511:30: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/libusb_util.c:515:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:516:31: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:527:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:531:7: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:537:23: call_function: calling 'possible_monitor_dev' from 'filter_possible_monitor_devs'
#  292|      struct libusb_device_descriptor desc;
#  293|       // copies data into struct pointed to by desc, does not allocate:
#  294|->     int rc = libusb_get_device_descriptor(dev, &desc);
#  295|       if (rc < 0) {
#  296|          REPORT_LIBUSB_ERROR_NOEXIT("libusb_get_device_descriptor",  rc);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def763]
ddcutil-2.2.1/src/usb_util/libusb_util.c:296:8: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/usb_util/libusb_util.c:501:18: enter_function: entry to 'filter_possible_monitor_devs'
ddcutil-2.2.1/src/usb_util/libusb_util.c:511:30: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/libusb_util.c:515:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:516:31: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:527:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:531:7: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:537:23: call_function: calling 'possible_monitor_dev' from 'filter_possible_monitor_devs'
#  294|       int rc = libusb_get_device_descriptor(dev, &desc);
#  295|       if (rc < 0) {
#  296|->        REPORT_LIBUSB_ERROR_NOEXIT("libusb_get_device_descriptor",  rc);
#  297|          goto bye;
#  298|       }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def764]
ddcutil-2.2.1/src/usb_util/libusb_util.c:303:4: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/usb_util/libusb_util.c:501:18: enter_function: entry to 'filter_possible_monitor_devs'
ddcutil-2.2.1/src/usb_util/libusb_util.c:511:30: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/libusb_util.c:515:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:516:31: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:527:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:531:7: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:537:23: call_function: calling 'possible_monitor_dev' from 'filter_possible_monitor_devs'
#  301|      result = possible_monitor_config_descriptor(config, dpath);
#  302|   
#  303|->    libusb_free_config_descriptor(config);
#  304|   
#  305|      if (!result && check_forced_monitor) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def765]
ddcutil-2.2.1/src/usb_util/libusb_util.c:307:16: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/usb_util/libusb_util.c:501:18: enter_function: entry to 'filter_possible_monitor_devs'
ddcutil-2.2.1/src/usb_util/libusb_util.c:511:30: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/libusb_util.c:515:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:516:31: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:527:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:531:7: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:537:23: call_function: calling 'possible_monitor_dev' from 'filter_possible_monitor_devs'
#  305|      if (!result && check_forced_monitor) {
#  306|         struct libusb_device_descriptor desc;
#  307|->       int rc = libusb_get_device_descriptor(dev, &desc);
#  308|         if (rc < 0) {
#  309|            REPORT_LIBUSB_ERROR_NOEXIT("libusb_device_descriptor", rc);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def766]
ddcutil-2.2.1/src/usb_util/libusb_util.c:309:10: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/usb_util/libusb_util.c:501:18: enter_function: entry to 'filter_possible_monitor_devs'
ddcutil-2.2.1/src/usb_util/libusb_util.c:511:30: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/libusb_util.c:515:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:516:31: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:527:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:531:7: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:537:23: call_function: calling 'possible_monitor_dev' from 'filter_possible_monitor_devs'
#  307|         int rc = libusb_get_device_descriptor(dev, &desc);
#  308|         if (rc < 0) {
#  309|->          REPORT_LIBUSB_ERROR_NOEXIT("libusb_device_descriptor", rc);
#  310|            goto bye;
#  311|         }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def767]
ddcutil-2.2.1/src/usb_util/libusb_util.c:346:25: warning[-Wanalyzer-malloc-leak]: leak of 'last_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:460:1: enter_function: entry to 'get_possible_monitors'
ddcutil-2.2.1/src/usb_util/libusb_util.c:468:44: call_function: calling 'new_possible_monitor_device' from 'get_possible_monitors'
ddcutil-2.2.1/src/usb_util/libusb_util.c:468:44: return_function: returning to 'get_possible_monitors' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:472:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:474:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:474:13: call_function: calling 'alt_possible_monitor_dev' from 'get_possible_monitors'
#  344|   
#  345|      // report_dev(dev, NULL, false /* show hubs */, 0);
#  346|->    int bus            = libusb_get_bus_number(dev);
#  347|      int device_address = libusb_get_device_address(dev);
#  348|      gushort vid = 0;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def768]
ddcutil-2.2.1/src/usb_util/libusb_util.c:347:25: warning[-Wanalyzer-malloc-leak]: leak of 'last_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:460:1: enter_function: entry to 'get_possible_monitors'
ddcutil-2.2.1/src/usb_util/libusb_util.c:468:44: call_function: calling 'new_possible_monitor_device' from 'get_possible_monitors'
ddcutil-2.2.1/src/usb_util/libusb_util.c:468:44: return_function: returning to 'get_possible_monitors' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:472:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:474:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:474:13: call_function: calling 'alt_possible_monitor_dev' from 'get_possible_monitors'
#  345|      // report_dev(dev, NULL, false /* show hubs */, 0);
#  346|      int bus            = libusb_get_bus_number(dev);
#  347|->    int device_address = libusb_get_device_address(dev);
#  348|      gushort vid = 0;
#  349|      gushort pid = 0;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def769]
ddcutil-2.2.1/src/usb_util/libusb_util.c:352:13: warning[-Wanalyzer-malloc-leak]: leak of 'last_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:460:1: enter_function: entry to 'get_possible_monitors'
ddcutil-2.2.1/src/usb_util/libusb_util.c:468:44: call_function: calling 'new_possible_monitor_device' from 'get_possible_monitors'
ddcutil-2.2.1/src/usb_util/libusb_util.c:468:44: return_function: returning to 'get_possible_monitors' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:472:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:474:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:474:13: call_function: calling 'alt_possible_monitor_dev' from 'get_possible_monitors'
#  350|   
#  351|      struct libusb_device_descriptor desc;
#  352|->    int rc = libusb_get_device_descriptor(dev, &desc);
#  353|      if (rc < 0) {
#  354|         REPORT_LIBUSB_ERROR_NOEXIT("libusb_device_descriptor", rc);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def770]
ddcutil-2.2.1/src/usb_util/libusb_util.c:354:7: warning[-Wanalyzer-malloc-leak]: leak of 'last_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:460:1: enter_function: entry to 'get_possible_monitors'
ddcutil-2.2.1/src/usb_util/libusb_util.c:468:44: call_function: calling 'new_possible_monitor_device' from 'get_possible_monitors'
ddcutil-2.2.1/src/usb_util/libusb_util.c:468:44: return_function: returning to 'get_possible_monitors' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:472:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:474:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:474:13: call_function: calling 'alt_possible_monitor_dev' from 'get_possible_monitors'
#  352|      int rc = libusb_get_device_descriptor(dev, &desc);
#  353|      if (rc < 0) {
#  354|->       REPORT_LIBUSB_ERROR_NOEXIT("libusb_device_descriptor", rc);
#  355|         goto bye;
#  356|      }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def771]
ddcutil-2.2.1/src/usb_util/libusb_util.c:361:9: warning[-Wanalyzer-malloc-leak]: leak of 'last_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:460:1: enter_function: entry to 'get_possible_monitors'
ddcutil-2.2.1/src/usb_util/libusb_util.c:468:44: call_function: calling 'new_possible_monitor_device' from 'get_possible_monitors'
ddcutil-2.2.1/src/usb_util/libusb_util.c:468:44: return_function: returning to 'get_possible_monitors' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:472:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:474:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:474:13: call_function: calling 'alt_possible_monitor_dev' from 'get_possible_monitors'
#  359|   
#  360|      struct libusb_config_descriptor * config;
#  361|->    rc = libusb_get_config_descriptor(dev, 0, &config);   // returns a pointer
#  362|      if (rc < 0) {
#  363|         REPORT_LIBUSB_ERROR_NOEXIT("libusb_config_descriptor", rc);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def772]
ddcutil-2.2.1/src/usb_util/libusb_util.c:363:7: warning[-Wanalyzer-malloc-leak]: leak of 'last_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:460:1: enter_function: entry to 'get_possible_monitors'
ddcutil-2.2.1/src/usb_util/libusb_util.c:468:44: call_function: calling 'new_possible_monitor_device' from 'get_possible_monitors'
ddcutil-2.2.1/src/usb_util/libusb_util.c:468:44: return_function: returning to 'get_possible_monitors' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:472:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:474:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:474:13: call_function: calling 'alt_possible_monitor_dev' from 'get_possible_monitors'
#  361|      rc = libusb_get_config_descriptor(dev, 0, &config);   // returns a pointer
#  362|      if (rc < 0) {
#  363|->       REPORT_LIBUSB_ERROR_NOEXIT("libusb_config_descriptor", rc);
#  364|         goto bye;
#  365|      }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def773]
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: warning[-Wanalyzer-malloc-leak]: leak of 'new_node'
ddcutil-2.2.1/src/usb_util/libusb_util.c:334:1: enter_function: entry to 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:353:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:357:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:362:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:372:54: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:403:22: branch_false: following 'false' branch (when 'new_node' is NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: call_function: calling 'new_possible_monitor_device' from 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: return_function: returning to 'alt_possible_monitor_dev' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: danger: 'new_node' leaks here; was allocated at [(18)](sarif:/runs/0/results/16/codeFlows/0/threadFlows/0/locations/17)
#  377|   
#  378|            if (idesc->bInterfaceClass == LIBUSB_CLASS_HID) {
#  379|->             rpt_vstring(0, "bInterfaceClass:     0x%02x (%d)", idesc->bInterfaceClass,    idesc->bInterfaceClass);
#  380|               rpt_vstring(0, "bInterfaceSubClass:  0x%02x (%d)", idesc->bInterfaceSubClass, idesc->bInterfaceSubClass);
#  381|               rpt_int("bInterfaceProtocol", NULL, idesc->bInterfaceProtocol, 0);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def774]
ddcutil-2.2.1/src/usb_util/libusb_util.c:380:13: warning[-Wanalyzer-malloc-leak]: leak of 'new_node'
ddcutil-2.2.1/src/usb_util/libusb_util.c:334:1: enter_function: entry to 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:353:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:357:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:362:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:372:54: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:403:22: branch_false: following 'false' branch (when 'new_node' is NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: call_function: calling 'new_possible_monitor_device' from 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: return_function: returning to 'alt_possible_monitor_dev' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:380:13: danger: 'new_node' leaks here; was allocated at [(18)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/17)
#  378|            if (idesc->bInterfaceClass == LIBUSB_CLASS_HID) {
#  379|               rpt_vstring(0, "bInterfaceClass:     0x%02x (%d)", idesc->bInterfaceClass,    idesc->bInterfaceClass);
#  380|->             rpt_vstring(0, "bInterfaceSubClass:  0x%02x (%d)", idesc->bInterfaceSubClass, idesc->bInterfaceSubClass);
#  381|               rpt_int("bInterfaceProtocol", NULL, idesc->bInterfaceProtocol, 0);
#  382|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def775]
ddcutil-2.2.1/src/usb_util/libusb_util.c:381:13: warning[-Wanalyzer-malloc-leak]: leak of 'new_node'
ddcutil-2.2.1/src/usb_util/libusb_util.c:334:1: enter_function: entry to 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:353:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:357:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:362:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:372:54: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:403:22: branch_false: following 'false' branch (when 'new_node' is NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: call_function: calling 'new_possible_monitor_device' from 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: return_function: returning to 'alt_possible_monitor_dev' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:381:13: danger: 'new_node' leaks here; was allocated at [(18)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/17)
#  379|               rpt_vstring(0, "bInterfaceClass:     0x%02x (%d)", idesc->bInterfaceClass,    idesc->bInterfaceClass);
#  380|               rpt_vstring(0, "bInterfaceSubClass:  0x%02x (%d)", idesc->bInterfaceSubClass, idesc->bInterfaceSubClass);
#  381|->             rpt_int("bInterfaceProtocol", NULL, idesc->bInterfaceProtocol, 0);
#  382|   
#  383|               if (idesc->bInterfaceProtocol != 1 && idesc->bInterfaceProtocol != 2)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def776]
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: warning[-Wanalyzer-malloc-leak]: leak of 'new_node'
ddcutil-2.2.1/src/usb_util/libusb_util.c:334:1: enter_function: entry to 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:353:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:357:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:362:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:372:54: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:403:22: branch_false: following 'false' branch (when 'new_node' is NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: call_function: calling 'new_possible_monitor_device' from 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: return_function: returning to 'alt_possible_monitor_dev' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: danger: 'new_node' leaks here; was allocated at [(18)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/17)
#  385|                  // TO ADDRESS: WHAT IF MULTIPLE altsettings?  what if they conflict?
#  386|   
#  387|->                libusb_ref_device(dev);
#  388|                  // if (debug)
#  389|                  //    report_dev(dev, NULL, false, 0);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def777]
ddcutil-2.2.1/src/usb_util/libusb_util.c:392:21: warning[-Wanalyzer-malloc-leak]: leak of 'new_node'
ddcutil-2.2.1/src/usb_util/libusb_util.c:334:1: enter_function: entry to 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:353:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:357:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:362:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:372:54: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:403:22: branch_false: following 'false' branch (when 'new_node' is NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: call_function: calling 'new_possible_monitor_device' from 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: return_function: returning to 'alt_possible_monitor_dev' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:392:21: danger: 'new_node' leaks here; was allocated at [(18)](sarif:/runs/0/results/20/codeFlows/0/threadFlows/0/locations/17)
#  390|   
#  391|                  struct libusb_device_handle * dh = NULL;
#  392|->                rc = libusb_open(dev, &dh);
#  393|                  if (rc < 0) {
#  394|                     REPORT_LIBUSB_ERROR_NOEXIT("libusb_open", rc);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def778]
ddcutil-2.2.1/src/usb_util/libusb_util.c:394:19: warning[-Wanalyzer-malloc-leak]: leak of 'new_node'
ddcutil-2.2.1/src/usb_util/libusb_util.c:334:1: enter_function: entry to 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:353:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:357:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:362:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:372:54: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:403:22: branch_false: following 'false' branch (when 'new_node' is NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: call_function: calling 'new_possible_monitor_device' from 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: return_function: returning to 'alt_possible_monitor_dev' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:394:19: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:394:19: danger: 'new_node' leaks here; was allocated at [(18)](sarif:/runs/0/results/21/codeFlows/0/threadFlows/0/locations/17)
#  392|                  rc = libusb_open(dev, &dh);
#  393|                  if (rc < 0) {
#  394|->                   REPORT_LIBUSB_ERROR_NOEXIT("libusb_open", rc);
#  395|                     dh = NULL;   // belt and suspenders
#  396|                  }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def779]
ddcutil-2.2.1/src/usb_util/libusb_util.c:399:24: warning[-Wanalyzer-malloc-leak]: leak of 'new_node'
ddcutil-2.2.1/src/usb_util/libusb_util.c:334:1: enter_function: entry to 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:353:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:357:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:362:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:372:54: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:403:22: branch_false: following 'false' branch (when 'new_node' is NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: call_function: calling 'new_possible_monitor_device' from 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: return_function: returning to 'alt_possible_monitor_dev' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:399:24: danger: 'new_node' leaks here; was allocated at [(18)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/17)
#  397|                  else {
#  398|                     printf("(%s) Successfully opened\n", __func__);
#  399|->                   rc = libusb_set_auto_detach_kernel_driver(dh, 1);
#  400|                     if (rc < 0)
#  401|                        REPORT_LIBUSB_ERROR_NOEXIT("libusb_set_auto_detach_kernel_driver", rc);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def780]
ddcutil-2.2.1/src/usb_util/libusb_util.c:401:22: warning[-Wanalyzer-malloc-leak]: leak of 'new_node'
ddcutil-2.2.1/src/usb_util/libusb_util.c:334:1: enter_function: entry to 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:353:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:357:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:362:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:372:54: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:403:22: branch_false: following 'false' branch (when 'new_node' is NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: call_function: calling 'new_possible_monitor_device' from 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: return_function: returning to 'alt_possible_monitor_dev' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:400:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:401:22: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:401:22: danger: 'new_node' leaks here; was allocated at [(18)](sarif:/runs/0/results/24/codeFlows/0/threadFlows/0/locations/17)
#  399|                     rc = libusb_set_auto_detach_kernel_driver(dh, 1);
#  400|                     if (rc < 0)
#  401|->                      REPORT_LIBUSB_ERROR_NOEXIT("libusb_set_auto_detach_kernel_driver", rc);
#  402|   
#  403|                     if (new_node) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def781]
ddcutil-2.2.1/src/usb_util/libusb_util.c:409:22: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'new_possible_monitor_device()'
ddcutil-2.2.1/src/usb_util/libusb_util.c:334:1: enter_function: entry to 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:353:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:357:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:362:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:372:54: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:403:22: branch_false: following 'false' branch (when 'new_node' is NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: call_function: calling 'new_possible_monitor_device' from 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: return_function: returning to 'alt_possible_monitor_dev' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:409:22: danger: 'new_possible_monitor_device()' could be NULL: unchecked value from [(18)](sarif:/runs/0/results/26/codeFlows/0/threadFlows/0/locations/17)
#  407|                     else {
#  408|                        new_node = new_possible_monitor_device();
#  409|->                      new_node->libusb_device = dev;
#  410|                        new_node->bus = bus;
#  411|                        new_node->device_address = device_address;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def782]
ddcutil-2.2.1/src/usb_util/libusb_util.c:429:52: warning[-Wanalyzer-malloc-leak]: leak of 'new_possible_monitor_device()'
ddcutil-2.2.1/src/usb_util/libusb_util.c:334:1: enter_function: entry to 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:353:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:357:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:362:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:372:54: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:403:22: branch_false: following 'false' branch (when 'new_node' is NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: call_function: calling 'new_possible_monitor_device' from 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: return_function: returning to 'alt_possible_monitor_dev' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:429:52: danger: 'new_possible_monitor_device()' leaks here; was allocated at [(18)](sarif:/runs/0/results/27/codeFlows/0/threadFlows/0/locations/17)
#  427|                        }
#  428|   
#  429|->                      new_node->manufacturer_name = g_strdup(lookup_libusb_string(dh, desc.iManufacturer));
#  430|                        new_node->product_name      = g_strdup(lookup_libusb_string(dh, desc.iProduct));
#  431|                        new_node->serial_number     = g_strdup(lookup_libusb_string(dh, desc.iSerialNumber));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def783]
ddcutil-2.2.1/src/usb_util/libusb_util.c:430:52: warning[-Wanalyzer-malloc-leak]: leak of 'new_possible_monitor_device()'
ddcutil-2.2.1/src/usb_util/libusb_util.c:334:1: enter_function: entry to 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:353:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:357:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:362:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:372:54: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:403:22: branch_false: following 'false' branch (when 'new_node' is NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: call_function: calling 'new_possible_monitor_device' from 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: return_function: returning to 'alt_possible_monitor_dev' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:430:52: danger: 'new_possible_monitor_device()' leaks here; was allocated at [(18)](sarif:/runs/0/results/28/codeFlows/0/threadFlows/0/locations/17)
#  428|   
#  429|                        new_node->manufacturer_name = g_strdup(lookup_libusb_string(dh, desc.iManufacturer));
#  430|->                      new_node->product_name      = g_strdup(lookup_libusb_string(dh, desc.iProduct));
#  431|                        new_node->serial_number     = g_strdup(lookup_libusb_string(dh, desc.iSerialNumber));
#  432|                     // new_node->serial_number_wide = wcsdup(lookup_libusb_string_wide(dh, desc.iSerialNumber));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def784]
ddcutil-2.2.1/src/usb_util/libusb_util.c:431:52: warning[-Wanalyzer-malloc-leak]: leak of 'new_possible_monitor_device()'
ddcutil-2.2.1/src/usb_util/libusb_util.c:334:1: enter_function: entry to 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:353:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:357:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:362:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:372:54: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:403:22: branch_false: following 'false' branch (when 'new_node' is NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: call_function: calling 'new_possible_monitor_device' from 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: return_function: returning to 'alt_possible_monitor_dev' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:431:52: danger: 'new_possible_monitor_device()' leaks here; was allocated at [(18)](sarif:/runs/0/results/29/codeFlows/0/threadFlows/0/locations/17)
#  429|                        new_node->manufacturer_name = g_strdup(lookup_libusb_string(dh, desc.iManufacturer));
#  430|                        new_node->product_name      = g_strdup(lookup_libusb_string(dh, desc.iProduct));
#  431|->                      new_node->serial_number     = g_strdup(lookup_libusb_string(dh, desc.iSerialNumber));
#  432|                     // new_node->serial_number_wide = wcsdup(lookup_libusb_string_wide(dh, desc.iSerialNumber));
#  433|                        // printf("(%s) serial_number_wide = |%S|\n", __func__, new_node->serial_number_wide);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def785]
ddcutil-2.2.1/src/usb_util/libusb_util.c:438:19: warning[-Wanalyzer-malloc-leak]: leak of 'new_node'
ddcutil-2.2.1/src/usb_util/libusb_util.c:334:1: enter_function: entry to 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:353:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:357:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:362:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:372:54: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:403:22: branch_false: following 'false' branch (when 'new_node' is NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: call_function: calling 'new_possible_monitor_device' from 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: return_function: returning to 'alt_possible_monitor_dev' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:438:19: danger: 'new_node' leaks here; was allocated at [(18)](sarif:/runs/0/results/30/codeFlows/0/threadFlows/0/locations/17)
#  436|                        // report_open_libusb_device(dh, 1);
#  437|                     }
#  438|->                   libusb_close(dh);
#  439|                  }
#  440|               }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def786]
ddcutil-2.2.1/src/usb_util/libusb_util.c:444:4: warning[-Wanalyzer-malloc-leak]: leak of 'new_node'
ddcutil-2.2.1/src/usb_util/libusb_util.c:334:1: enter_function: entry to 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:353:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:357:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:362:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:372:54: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:376:63: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:378:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:379:13: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:383:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:387:16: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:393:19: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:398:19: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:403:22: branch_false: following 'false' branch (when 'new_node' is NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: call_function: calling 'new_possible_monitor_device' from 'alt_possible_monitor_dev'
ddcutil-2.2.1/src/usb_util/libusb_util.c:408:33: return_function: returning to 'alt_possible_monitor_dev' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:375:25: branch_false: following 'false' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:444:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:444:4: danger: 'new_node' leaks here; was allocated at [(18)](sarif:/runs/0/results/31/codeFlows/0/threadFlows/0/locations/17)
#  442|         }
#  443|      }
#  444|->    libusb_free_config_descriptor(config);
#  445|   
#  446|   bye:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def787]
ddcutil-2.2.1/src/usb_util/libusb_util.c:482:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'last_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:460:1: enter_function: entry to 'get_possible_monitors'
ddcutil-2.2.1/src/usb_util/libusb_util.c:468:44: call_function: calling 'new_possible_monitor_device' from 'get_possible_monitors'
ddcutil-2.2.1/src/usb_util/libusb_util.c:468:44: return_function: returning to 'get_possible_monitors' from 'new_possible_monitor_device'
ddcutil-2.2.1/src/usb_util/libusb_util.c:472:11: branch_false: following 'false' branch (when 'dev' is NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:482:4: branch_false: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:482:4: danger: 'new_possible_monitor_device()' could be NULL: unchecked value from [(4)](sarif:/runs/0/results/32/codeFlows/0/threadFlows/0/locations/3)
#  480|   
#  481|      struct possible_monitor_device * true_head;
#  482|->    true_head = head_device->next;
#  483|      free(head_device);
#  484|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def788]
ddcutil-2.2.1/src/usb_util/libusb_util.c:516:31: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/usb_util/libusb_util.c:511:30: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/libusb_util.c:515:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:516:31: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:516:31: danger: 'result' leaks here; was allocated at [(1)](sarif:/runs/0/results/33/codeFlows/0/threadFlows/0/locations/0)
#  514|      int i = 0;
#  515|      while ((dev = devs[i++]) != NULL) {
#  516|->       unsigned short busno =  libusb_get_bus_number(dev);
#  517|         unsigned short devno =  libusb_get_device_address(dev);
#  518|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def789]
ddcutil-2.2.1/src/usb_util/libusb_util.c:517:31: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/usb_util/libusb_util.c:511:30: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/libusb_util.c:515:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:516:31: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:517:31: danger: 'result' leaks here; was allocated at [(1)](sarif:/runs/0/results/34/codeFlows/0/threadFlows/0/locations/0)
#  515|      while ((dev = devs[i++]) != NULL) {
#  516|         unsigned short busno =  libusb_get_bus_number(dev);
#  517|->       unsigned short devno =  libusb_get_device_address(dev);
#  518|   
#  519|         Descriptor_Path dpath;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def790]
ddcutil-2.2.1/src/usb_util/libusb_util.c:526:16: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/usb_util/libusb_util.c:511:30: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/libusb_util.c:515:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:516:31: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:526:16: danger: 'result' leaks here; was allocated at [(1)](sarif:/runs/0/results/35/codeFlows/0/threadFlows/0/locations/0)
#  524|         struct libusb_device_descriptor desc;
#  525|         // copies data into struct pointed to by desc, does not allocate:
#  526|->       int rc = libusb_get_device_descriptor(dev, &desc);
#  527|         if (rc < 0) {
#  528|            REPORT_LIBUSB_ERROR_NOEXIT("libusb_get_device_descriptor",  rc);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def791]
ddcutil-2.2.1/src/usb_util/libusb_util.c:528:10: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/usb_util/libusb_util.c:511:30: acquire_memory: allocated here
ddcutil-2.2.1/src/usb_util/libusb_util.c:515:11: branch_true: following 'true' branch (when 'dev' is non-NULL)...
ddcutil-2.2.1/src/usb_util/libusb_util.c:516:31: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:527:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/usb_util/libusb_util.c:528:10: branch_true: ...to here
ddcutil-2.2.1/src/usb_util/libusb_util.c:528:10: danger: 'result' leaks here; was allocated at [(1)](sarif:/runs/0/results/36/codeFlows/0/threadFlows/0/locations/0)
#  526|         int rc = libusb_get_device_descriptor(dev, &desc);
#  527|         if (rc < 0) {
#  528|->          REPORT_LIBUSB_ERROR_NOEXIT("libusb_get_device_descriptor",  rc);
#  529|            break;
#  530|         }

Error: CPPCHECK_WARNING (CWE-476): [#def792]
ddcutil-2.2.1/src/util/backtrace.c:69: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#   67|         }
#   68|         result = malloc(len+1);
#   69|->       memcpy(result, start, len);
#   70|         result[len] = '\0';
#   71|      }

Error: CPPCHECK_WARNING (CWE-476): [#def793]
ddcutil-2.2.1/src/util/backtrace.c:70: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#   68|         result = malloc(len+1);
#   69|         memcpy(result, start, len);
#   70|->       result[len] = '\0';
#   71|      }
#   72|      if (name_only) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def794]
ddcutil-2.2.1/src/util/backtrace.c:73:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'result' where non-null expected
ddcutil-2.2.1/src/util/backtrace.c:146:13: enter_function: entry to 'get_backtrace'
ddcutil-2.2.1/src/util/backtrace.c:163:7: branch_false: following 'false' branch (when 'strings' is non-NULL)...
ddcutil-2.2.1/src/util/backtrace.c:168:38: branch_false: ...to here
ddcutil-2.2.1/src/util/backtrace.c:171:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/backtrace.c:172:13: branch_true: ...to here
ddcutil-2.2.1/src/util/backtrace.c:172:13: branch_false: following 'false' branch (when 'j >= stack_adjust')...
ddcutil-2.2.1/src/util/backtrace.c:178:48: branch_false: ...to here
ddcutil-2.2.1/src/util/backtrace.c:178:24: call_function: calling 'extract_function' from 'get_backtrace'
#argument 1 of '__builtin_strchr' must be non-null
#   71|      }
#   72|      if (name_only) {
#   73|->       char *p = strchr(result, '+');
#   74|         if (p) {
#   75|            *p = '\0';

Error: GCC_ANALYZER_WARNING (CWE-401): [#def795]
ddcutil-2.2.1/src/util/backtrace.c:181:13: warning[-Wanalyzer-malloc-leak]: leak of 'extract_function(*<unknown>, 1)'
ddcutil-2.2.1/src/util/backtrace.c:146:13: enter_function: entry to 'get_backtrace'
ddcutil-2.2.1/src/util/backtrace.c:163:7: branch_false: following 'false' branch (when 'strings' is non-NULL)...
ddcutil-2.2.1/src/util/backtrace.c:168:38: branch_false: ...to here
ddcutil-2.2.1/src/util/backtrace.c:171:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/backtrace.c:172:13: branch_true: ...to here
ddcutil-2.2.1/src/util/backtrace.c:172:13: branch_false: following 'false' branch (when 'j >= stack_adjust')...
ddcutil-2.2.1/src/util/backtrace.c:178:48: branch_false: ...to here
ddcutil-2.2.1/src/util/backtrace.c:178:24: call_function: calling 'extract_function' from 'get_backtrace'
ddcutil-2.2.1/src/util/backtrace.c:178:24: return_function: returning to 'get_backtrace' from 'extract_function'
ddcutil-2.2.1/src/util/backtrace.c:181:13: danger: 'extract_function(*<unknown>, 1)' leaks here; was allocated at [(16)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/15)
#  179|               if (debug)
#  180|                  printf("   %s\n", s);
#  181|->             g_ptr_array_add(result, s);
#  182|               bool final = (streq(s, "main")) ? true : false;
#  183|               if (final)

Error: CPPCHECK_WARNING (CWE-476): [#def796]
ddcutil-2.2.1/src/util/data_structures.c:57: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buffer
#   55|      // printf("(%s) sizeof(Buffer)=%ld, size=%d\n", __func__, sizeof(Buffer), size);    // sizeof(Buffer) == 16
#   56|      Buffer * buffer = (Buffer *) malloc(sizeof(Buffer));
#   57|->    memcpy(buffer->marker, BUFFER_MARKER, 4);
#   58|      buffer->bytes = (Byte *) calloc(1, hacked_size);    // hack
#   59|      buffer->buffer_size = size;

Error: CPPCHECK_WARNING (CWE-476): [#def797]
ddcutil-2.2.1/src/util/data_structures.c:58: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buffer
#   56|      Buffer * buffer = (Buffer *) malloc(sizeof(Buffer));
#   57|      memcpy(buffer->marker, BUFFER_MARKER, 4);
#   58|->    buffer->bytes = (Byte *) calloc(1, hacked_size);    // hack
#   59|      buffer->buffer_size = size;
#   60|      buffer->len = 0;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def798]
ddcutil-2.2.1/src/util/data_structures.c:58:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'buffer'
ddcutil-2.2.1/src/util/data_structures.c:56:33: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/data_structures.c:58:4: danger: 'buffer' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   56|      Buffer * buffer = (Buffer *) malloc(sizeof(Buffer));
#   57|      memcpy(buffer->marker, BUFFER_MARKER, 4);
#   58|->    buffer->bytes = (Byte *) calloc(1, hacked_size);    // hack
#   59|      buffer->buffer_size = size;
#   60|      buffer->len = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def799]
ddcutil-2.2.1/src/util/data_structures.c:59: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buffer
#   57|      memcpy(buffer->marker, BUFFER_MARKER, 4);
#   58|      buffer->bytes = (Byte *) calloc(1, hacked_size);    // hack
#   59|->    buffer->buffer_size = size;
#   60|      buffer->len = 0;
#   61|      buffer->size_increment = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def800]
ddcutil-2.2.1/src/util/data_structures.c:60: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buffer
#   58|      buffer->bytes = (Byte *) calloc(1, hacked_size);    // hack
#   59|      buffer->buffer_size = size;
#   60|->    buffer->len = 0;
#   61|      buffer->size_increment = 0;
#   62|      if (trace_buffer_malloc_free)

Error: CPPCHECK_WARNING (CWE-476): [#def801]
ddcutil-2.2.1/src/util/data_structures.c:61: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buffer
#   59|      buffer->buffer_size = size;
#   60|      buffer->len = 0;
#   61|->    buffer->size_increment = 0;
#   62|      if (trace_buffer_malloc_free)
#   63|         printf("(%s) Allocated buffer.  buffer=%p, buffer->bytes=%p, &buffer->bytes=%p, %s\n",

Error: GCC_ANALYZER_WARNING (CWE-476): [#def802]
ddcutil-2.2.1/src/util/data_structures.c:296:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL '*buffer.bytes + (sizetype)*buffer.len'
ddcutil-2.2.1/src/util/data_structures.c:1378:10: enter_function: entry to 'bs256_to_buffer'
ddcutil-2.2.1/src/util/data_structures.c:1379:21: call_function: calling 'bs256_count' from 'bs256_to_buffer'
ddcutil-2.2.1/src/util/data_structures.c:1379:21: return_function: returning to 'bs256_to_buffer' from 'bs256_count'
ddcutil-2.2.1/src/util/data_structures.c:1380:19: call_function: calling 'buffer_new' from 'bs256_to_buffer'
ddcutil-2.2.1/src/util/data_structures.c:1380:19: return_function: returning to 'bs256_to_buffer' from 'buffer_new'
ddcutil-2.2.1/src/util/data_structures.c:1381:34: branch_true: following 'true' branch (when 'flagno != 256')...
ddcutil-2.2.1/src/util/data_structures.c:1382:12: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1384:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/data_structures.c:1385:10: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1385:10: call_function: calling 'buffer_add' from 'bs256_to_buffer'
#  294|      assert( memcmp(buffer->marker, BUFFER_MARKER, 4) == 0);
#  295|      assert(buffer->len + 1 <= buffer->buffer_size);
#  296|->    buffer->bytes[buffer->len++] = byte;
#  297|   }
#  298|   

Error: CPPCHECK_WARNING (CWE-476): [#def803]
ddcutil-2.2.1/src/util/data_structures.c:382: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: csb
#  380|   csb_new(int size) {
#  381|      Circular_String_Buffer * csb = calloc(1, sizeof(Circular_String_Buffer));
#  382|->    csb->lines = calloc(size, sizeof(char*));
#  383|      csb->size = size;
#  384|      csb->ct = 0;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def804]
ddcutil-2.2.1/src/util/data_structures.c:382:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'csb'
ddcutil-2.2.1/src/util/data_structures.c:381:35: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/data_structures.c:382:4: danger: 'csb' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  380|   csb_new(int size) {
#  381|      Circular_String_Buffer * csb = calloc(1, sizeof(Circular_String_Buffer));
#  382|->    csb->lines = calloc(size, sizeof(char*));
#  383|      csb->size = size;
#  384|      csb->ct = 0;

Error: CPPCHECK_WARNING (CWE-476): [#def805]
ddcutil-2.2.1/src/util/data_structures.c:383: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: csb
#  381|      Circular_String_Buffer * csb = calloc(1, sizeof(Circular_String_Buffer));
#  382|      csb->lines = calloc(size, sizeof(char*));
#  383|->    csb->size = size;
#  384|      csb->ct = 0;
#  385|      return csb;

Error: CPPCHECK_WARNING (CWE-476): [#def806]
ddcutil-2.2.1/src/util/data_structures.c:384: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: csb
#  382|      csb->lines = calloc(size, sizeof(char*));
#  383|      csb->size = size;
#  384|->    csb->ct = 0;
#  385|      return csb;
#  386|   }

Error: GCC_ANALYZER_WARNING (CWE-688): [#def807]
ddcutil-2.2.1/src/util/data_structures.c:697:63: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected
ddcutil-2.2.1/src/util/data_structures.c:687:8: enter_function: entry to 'vnt_interpret_flags_t'
ddcutil-2.2.1/src/util/data_structures.c:696:21: call_function: calling 'vnt_interpret_flags' from 'vnt_interpret_flags_t'
ddcutil-2.2.1/src/util/data_structures.c:696:21: return_function: returning to 'vnt_interpret_flags_t' from 'vnt_interpret_flags'
ddcutil-2.2.1/src/util/data_structures.c:697:63: danger: argument 1 ('vnt_interpret_flags(flags_val,  bitname_table,  use_title,  sepstr)') NULL where non-null expected
#argument 1 of '__builtin_strlen' must be non-null
#  695|   
#  696|      char * buftemp = vnt_interpret_flags(flags_val, bitname_table, use_title, sepstr);
#  697|->    char * buf = get_thread_dynamic_buffer(&x_key, &x_len_key, strlen(buftemp)+1);
#  698|      strcpy(buf, buftemp);
#  699|      free(buftemp);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def808]
ddcutil-2.2.1/src/util/data_structures.c:777:23: warning[-Wanalyzer-malloc-leak]: leak of 'buf'
ddcutil-2.2.1/src/util/data_structures.c:1899:6: enter_function: entry to 'bva_store_bytehex_list'
ddcutil-2.2.1/src/util/data_structures.c:1900:11: call_function: calling 'store_bytehex_list' from 'bva_store_bytehex_list'
#  775|      g_byte_array_append(ga, &item, 1);
#  776|   #else
#  777|->    GByteArray * ga2 = g_byte_array_append(ga, &item, 1);
#  778|      assert(ga2 == ga);
#  779|   #endif

Error: GCC_ANALYZER_WARNING (CWE-401): [#def809]
ddcutil-2.2.1/src/util/data_structures.c:777:23: warning[-Wanalyzer-malloc-leak]: leak of 'curpos'
ddcutil-2.2.1/src/util/data_structures.c:1899:6: enter_function: entry to 'bva_store_bytehex_list'
ddcutil-2.2.1/src/util/data_structures.c:1900:11: call_function: calling 'store_bytehex_list' from 'bva_store_bytehex_list'
#  775|      g_byte_array_append(ga, &item, 1);
#  776|   #else
#  777|->    GByteArray * ga2 = g_byte_array_append(ga, &item, 1);
#  778|      assert(ga2 == ga);
#  779|   #endif

Error: GCC_ANALYZER_WARNING (CWE-688): [#def810]
ddcutil-2.2.1/src/util/data_structures.c:921:47: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'buf' where non-null expected
ddcutil-2.2.1/src/util/data_structures.c:909:4: branch_false: following 'false' branch (when 'bva' is non-NULL)...
ddcutil-2.2.1/src/util/data_structures.c:911:7: branch_false: ...to here
ddcutil-2.2.1/src/util/data_structures.c:917:17: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/data_structures.c:918:22: branch_true: following 'true' branch (when 'ndx < len')...
ddcutil-2.2.1/src/util/data_structures.c:919:23: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:919:23: branch_false: following 'false' branch (when 'ndx == 0')...
 branch_false: ...to here
ddcutil-2.2.1/src/util/data_structures.c:920:10: branch_true: following 'true' branch (when 'as_hex != 0')...
ddcutil-2.2.1/src/util/data_structures.c:921:83: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:921:47: danger: argument 1 ('buf') from [(3)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
#argument 1 of '__builtin_strlen' must be non-null
#  919|         char * cursep = (ndx > 0) ? sep : "";
#  920|         if (as_hex)
#  921|->          snprintf(buf + strlen(buf), alloc_sz-strlen(buf), "%s%02x", cursep, bytes[ndx]);
#  922|         else
#  923|            snprintf(buf + strlen(buf), alloc_sz-strlen(buf), "%s%d", cursep, bytes[ndx]);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def811]
ddcutil-2.2.1/src/util/data_structures.c:923:47: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'buf' where non-null expected
ddcutil-2.2.1/src/util/data_structures.c:909:4: branch_false: following 'false' branch (when 'bva' is non-NULL)...
ddcutil-2.2.1/src/util/data_structures.c:911:7: branch_false: ...to here
ddcutil-2.2.1/src/util/data_structures.c:917:17: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/data_structures.c:918:22: branch_true: following 'true' branch (when 'ndx < len')...
ddcutil-2.2.1/src/util/data_structures.c:919:23: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:919:23: branch_false: following 'false' branch (when 'ndx == 0')...
 branch_false: ...to here
ddcutil-2.2.1/src/util/data_structures.c:920:10: branch_false: following 'false' branch (when 'as_hex == 0')...
ddcutil-2.2.1/src/util/data_structures.c:923:81: branch_false: ...to here
ddcutil-2.2.1/src/util/data_structures.c:923:47: danger: argument 1 ('buf') from [(3)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
#argument 1 of '__builtin_strlen' must be non-null
#  921|            snprintf(buf + strlen(buf), alloc_sz-strlen(buf), "%s%02x", cursep, bytes[ndx]);
#  922|         else
#  923|->          snprintf(buf + strlen(buf), alloc_sz-strlen(buf), "%s%d", cursep, bytes[ndx]);
#  924|      }
#  925|      return buf;

Error: CPPCHECK_WARNING (CWE-476): [#def812]
ddcutil-2.2.1/src/util/data_structures.c:1407: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
# 1405|   bs256_iter_new(Bit_Set_256 bbflags) {
# 1406|      _Bit_Set_256_Iterator * result = malloc(sizeof(_Bit_Set_256_Iterator));
# 1407|->    memcpy(result->marker, BS256_ITER_MARKER, 4);
# 1408|      result->bbflags = bbflags;   // TODO: save pointer to unopaque _BitByteFlags
# 1409|      result->lastpos = -1;

Error: CPPCHECK_WARNING (CWE-476): [#def813]
ddcutil-2.2.1/src/util/data_structures.c:1408: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
# 1406|      _Bit_Set_256_Iterator * result = malloc(sizeof(_Bit_Set_256_Iterator));
# 1407|      memcpy(result->marker, BS256_ITER_MARKER, 4);
# 1408|->    result->bbflags = bbflags;   // TODO: save pointer to unopaque _BitByteFlags
# 1409|      result->lastpos = -1;
# 1410|      return result;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def814]
ddcutil-2.2.1/src/util/data_structures.c:1408:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/util/data_structures.c:1406:37: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/data_structures.c:1408:4: danger: 'result' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/0)
# 1406|      _Bit_Set_256_Iterator * result = malloc(sizeof(_Bit_Set_256_Iterator));
# 1407|      memcpy(result->marker, BS256_ITER_MARKER, 4);
# 1408|->    result->bbflags = bbflags;   // TODO: save pointer to unopaque _BitByteFlags
# 1409|      result->lastpos = -1;
# 1410|      return result;

Error: CPPCHECK_WARNING (CWE-476): [#def815]
ddcutil-2.2.1/src/util/data_structures.c:1409: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
# 1407|      memcpy(result->marker, BS256_ITER_MARKER, 4);
# 1408|      result->bbflags = bbflags;   // TODO: save pointer to unopaque _BitByteFlags
# 1409|->    result->lastpos = -1;
# 1410|      return result;
# 1411|   }

Error: CPPCHECK_WARNING (CWE-758): [#def816]
ddcutil-2.2.1/src/util/data_structures.c:1613: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 1611|      int result = 0;
# 1612|      for (int bitndx = 0; bitndx < 32; bitndx++) {
# 1613|->       unsigned char flagbit = (0x80 >> bitndx);
# 1614|         if (bbset & flagbit)
# 1615|            result += 1;

Error: CPPCHECK_WARNING (CWE-758): [#def817]
ddcutil-2.2.1/src/util/data_structures.c:1628: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 1626|   bool bs32_contains(Bit_Set_32 flags, uint8_t val) {
# 1627|      assert(val < BIT_SET_32_MAX);
# 1628|->    bool result = flags & (1 << val);
# 1629|      return result;
# 1630|   }

Error: CPPCHECK_WARNING (CWE-476): [#def818]
ddcutil-2.2.1/src/util/data_structures.c:1850: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
# 1848|   
# 1849|      char * buf = malloc(len+1);
# 1850|->    memcpy(buf, start, len);
# 1851|      buf[len] = '\0';
# 1852|   

Error: CPPCHECK_WARNING (CWE-476): [#def819]
ddcutil-2.2.1/src/util/data_structures.c:1851: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
# 1849|      char * buf = malloc(len+1);
# 1850|      memcpy(buf, start, len);
# 1851|->    buf[len] = '\0';
# 1852|   
# 1853|      char * curpos = buf;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def820]
ddcutil-2.2.1/src/util/data_structures.c:1863:18: warning[-Wanalyzer-malloc-leak]: leak of 'buf'
ddcutil-2.2.1/src/util/data_structures.c:1849:17: acquire_memory: allocated here
ddcutil-2.2.1/src/util/data_structures.c:1856:12: branch_true: following 'true' branch (when 'nexttok' is non-NULL)...
ddcutil-2.2.1/src/util/data_structures.c:1859:16: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1856:12: branch_true: following 'true' branch (when 'nexttok' is non-NULL)...
ddcutil-2.2.1/src/util/data_structures.c:1859:16: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1861:10: branch_true: following 'true' branch (when 'ln == 2')...
ddcutil-2.2.1/src/util/data_structures.c:1863:18: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1863:18: danger: 'buf' leaks here; was allocated at [(1)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/0)
# 1861|         if (ln == 2) {                // normal case
# 1862|            // byteVal = hhc_to_byte(nexttok);
# 1863|->          hexok = hhc_to_byte_in_buf(nexttok, &byteVal);
# 1864|         }
# 1865|         else if (ln == 1) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def821]
ddcutil-2.2.1/src/util/data_structures.c:1863:18: warning[-Wanalyzer-malloc-leak]: leak of 'curpos'
ddcutil-2.2.1/src/util/data_structures.c:1849:17: acquire_memory: allocated here
ddcutil-2.2.1/src/util/data_structures.c:1856:12: branch_true: following 'true' branch (when 'nexttok' is non-NULL)...
ddcutil-2.2.1/src/util/data_structures.c:1859:16: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1861:10: branch_true: following 'true' branch (when 'ln == 2')...
ddcutil-2.2.1/src/util/data_structures.c:1863:18: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1863:18: danger: 'curpos' leaks here; was allocated at [(1)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/0)
# 1861|         if (ln == 2) {                // normal case
# 1862|            // byteVal = hhc_to_byte(nexttok);
# 1863|->          hexok = hhc_to_byte_in_buf(nexttok, &byteVal);
# 1864|         }
# 1865|         else if (ln == 1) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def822]
ddcutil-2.2.1/src/util/data_structures.c:1874:18: warning[-Wanalyzer-malloc-leak]: leak of 'buf'
ddcutil-2.2.1/src/util/data_structures.c:1849:17: acquire_memory: allocated here
ddcutil-2.2.1/src/util/data_structures.c:1856:12: branch_true: following 'true' branch (when 'nexttok' is non-NULL)...
ddcutil-2.2.1/src/util/data_structures.c:1859:16: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1856:12: branch_true: following 'true' branch (when 'nexttok' is non-NULL)...
ddcutil-2.2.1/src/util/data_structures.c:1859:16: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1861:10: branch_false: following 'false' branch (when 'ln != 2')...
ddcutil-2.2.1/src/util/data_structures.c:1865:15: branch_false: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1865:15: branch_true: following 'true' branch (when 'ln == 1')...
ddcutil-2.2.1/src/util/data_structures.c:1871:10: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1874:18: danger: 'buf' leaks here; was allocated at [(1)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/0)
# 1872|            buf[1] = *nexttok;
# 1873|            // byteVal = hhc_to_byte(buf);
# 1874|->          hexok = hhc_to_byte_in_buf(buf, &byteVal);
# 1875|         }
# 1876|         if (!hexok) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def823]
ddcutil-2.2.1/src/util/data_structures.c:1874:18: warning[-Wanalyzer-malloc-leak]: leak of 'curpos'
ddcutil-2.2.1/src/util/data_structures.c:1849:17: acquire_memory: allocated here
ddcutil-2.2.1/src/util/data_structures.c:1856:12: branch_true: following 'true' branch (when 'nexttok' is non-NULL)...
ddcutil-2.2.1/src/util/data_structures.c:1859:16: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1861:10: branch_false: following 'false' branch (when 'ln != 2')...
ddcutil-2.2.1/src/util/data_structures.c:1865:15: branch_false: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1865:15: branch_true: following 'true' branch (when 'ln == 1')...
ddcutil-2.2.1/src/util/data_structures.c:1871:10: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1874:18: danger: 'curpos' leaks here; was allocated at [(1)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/0)
# 1872|            buf[1] = *nexttok;
# 1873|            // byteVal = hhc_to_byte(buf);
# 1874|->          hexok = hhc_to_byte_in_buf(buf, &byteVal);
# 1875|         }
# 1876|         if (!hexok) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def824]
ddcutil-2.2.1/src/util/data_structures.c:1882:10: warning[-Wanalyzer-malloc-leak]: leak of 'buf'
ddcutil-2.2.1/src/util/data_structures.c:1849:17: acquire_memory: allocated here
ddcutil-2.2.1/src/util/data_structures.c:1856:12: branch_true: following 'true' branch (when 'nexttok' is non-NULL)...
ddcutil-2.2.1/src/util/data_structures.c:1859:16: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1856:12: branch_true: following 'true' branch (when 'nexttok' is non-NULL)...
ddcutil-2.2.1/src/util/data_structures.c:1859:16: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1876:10: branch_true: following 'true' branch (when 'hexok != 0')...
ddcutil-2.2.1/src/util/data_structures.c:1882:10: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1882:10: danger: 'buf' leaks here; was allocated at [(1)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/0)
# 1880|         // printf("(%s) byteVal=0x%02x  \n", __func__, byteVal );
# 1881|         if (hexok)
# 1882|->          appender(data_struct, byteVal);
# 1883|      }
# 1884|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def825]
ddcutil-2.2.1/src/util/data_structures.c:1882:10: warning[-Wanalyzer-malloc-leak]: leak of 'curpos'
ddcutil-2.2.1/src/util/data_structures.c:1849:17: acquire_memory: allocated here
ddcutil-2.2.1/src/util/data_structures.c:1856:12: branch_true: following 'true' branch (when 'nexttok' is non-NULL)...
ddcutil-2.2.1/src/util/data_structures.c:1859:16: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1876:10: branch_true: following 'true' branch (when 'hexok != 0')...
ddcutil-2.2.1/src/util/data_structures.c:1882:10: branch_true: ...to here
ddcutil-2.2.1/src/util/data_structures.c:1882:10: danger: 'curpos' leaks here; was allocated at [(1)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/0)
# 1880|         // printf("(%s) byteVal=0x%02x  \n", __func__, byteVal );
# 1881|         if (hexok)
# 1882|->          appender(data_struct, byteVal);
# 1883|      }
# 1884|   

Error: CPPCHECK_WARNING (CWE-476): [#def826]
ddcutil-2.2.1/src/util/ddcutil_config_file.c:184: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: combined
#  182|         char ** combined = calloc(new_ct, sizeof(char *));
#  183|         DBGF(debug, "Allocated combined=%p", combined);
#  184|->       combined[0] = g_strdup(old_argv[0]);   // command
#  185|         DBGF(debug, "Allocated combined[0] = %p -> |%s|",  combined[0], combined[0] );
#  186|         DBGF(debug, "Copying config_token_ct=%d config file tokens", config_token_ct);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def827]
ddcutil-2.2.1/src/util/ddcutil_config_file.c:184:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'combined'
ddcutil-2.2.1/src/util/ddcutil_config_file.c:163:5: enter_function: entry to 'merge_command_tokens'
ddcutil-2.2.1/src/util/ddcutil_config_file.c:173:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/ddcutil_config_file.c:174:4: branch_false: ...to here
ddcutil-2.2.1/src/util/ddcutil_config_file.c:174:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/ddcutil_config_file.c:176:4: branch_false: ...to here
ddcutil-2.2.1/src/util/ddcutil_config_file.c:179:7: branch_true: following 'true' branch (when 'config_token_ct > 0')...
ddcutil-2.2.1/src/util/ddcutil_config_file.c:180:20: branch_true: ...to here
ddcutil-2.2.1/src/util/ddcutil_config_file.c:182:26: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/ddcutil_config_file.c:184:7: danger: 'combined' could be NULL: unchecked value from [(8)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/7)
#  182|         char ** combined = calloc(new_ct, sizeof(char *));
#  183|         DBGF(debug, "Allocated combined=%p", combined);
#  184|->       combined[0] = g_strdup(old_argv[0]);   // command
#  185|         DBGF(debug, "Allocated combined[0] = %p -> |%s|",  combined[0], combined[0] );
#  186|         DBGF(debug, "Copying config_token_ct=%d config file tokens", config_token_ct);

Error: CPPCHECK_WARNING (CWE-476): [#def828]
ddcutil-2.2.1/src/util/ddcutil_config_file.c:185: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: combined
#  183|         DBGF(debug, "Allocated combined=%p", combined);
#  184|         combined[0] = g_strdup(old_argv[0]);   // command
#  185|->       DBGF(debug, "Allocated combined[0] = %p -> |%s|",  combined[0], combined[0] );
#  186|         DBGF(debug, "Copying config_token_ct=%d config file tokens", config_token_ct);
#  187|         int new_ndx = 1;

Error: CPPCHECK_WARNING (CWE-476): [#def829]
ddcutil-2.2.1/src/util/ddcutil_config_file.c:189: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: combined
#  187|         int new_ndx = 1;
#  188|         for (int prefix_ndx = 0; prefix_ndx < config_token_ct; prefix_ndx++, new_ndx++) {
#  189|->          combined[new_ndx] = g_strdup(config_tokens[prefix_ndx]);
#  190|            DBGF(debug, "Allocated combined[%d]=%p -> |%s|",
#  191|                        new_ndx, combined[new_ndx], combined[new_ndx]);

Error: GCC_ANALYZER_WARNING (CWE-404): [#def830]
ddcutil-2.2.1/src/util/debug_util.c:91:23: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
ddcutil-2.2.1/src/util/debug_util.c:88:7: branch_true: following 'true' branch (when 'debug_flag != 0')...
ddcutil-2.2.1/src/util/debug_util.c:90:7: branch_true: ...to here
ddcutil-2.2.1/src/util/debug_util.c:90:7: acquire_resource: 'va_start' called here
ddcutil-2.2.1/src/util/debug_util.c:91:23: danger: missing call to 'va_end' to match 'va_start' at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#   89|         va_list(args);
#   90|         va_start(args, format);
#   91|->       char * buffer = g_strdup_vprintf(format, args);
#   92|         va_end(args);
#   93|   

Error: CPPCHECK_WARNING (CWE-476): [#def831]
ddcutil-2.2.1/src/util/device_id_util.c:136: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_entry
#  134|   sit_add(Simple_Id_Table * simple_table, gushort id, char * name) {
#  135|      Simple_Id_Table_Entry * new_entry = calloc(1, sizeof(Simple_Id_Table_Entry));
#  136|->    new_entry->id = id;
#  137|      new_entry->name = g_strdup(name);
#  138|      g_ptr_array_add(simple_table, new_entry);

Error: CPPCHECK_WARNING (CWE-476): [#def832]
ddcutil-2.2.1/src/util/device_id_util.c:137: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_entry
#  135|      Simple_Id_Table_Entry * new_entry = calloc(1, sizeof(Simple_Id_Table_Entry));
#  136|      new_entry->id = id;
#  137|->    new_entry->name = g_strdup(name);
#  138|      g_ptr_array_add(simple_table, new_entry);
#  139|      return new_entry;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def833]
ddcutil-2.2.1/src/util/drm_card_connector_util.c:137:4: warning[-Wanalyzer-malloc-leak]: leak of 'accumulator'
ddcutil-2.2.1/src/util/drm_card_connector_util.c:136:39: acquire_memory: allocated here
ddcutil-2.2.1/src/util/drm_card_connector_util.c:137:4: danger: 'accumulator' leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  135|      int d = (debug) ? 1 : -1;
#  136|      Check_Card_Struct *  accumulator = calloc(1, sizeof(Check_Card_Struct));
#  137|->    dir_foreach(drm_dir, predicate_cardN, do_one_card, accumulator, d);
#  138|      bool has_card_subdir = accumulator->has_card_connector_dir;
#  139|      free(accumulator);

Error: CPPCHECK_WARNING (CWE-476): [#def834]
ddcutil-2.2.1/src/util/drm_card_connector_util.c:138: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: accumulator
#  136|      Check_Card_Struct *  accumulator = calloc(1, sizeof(Check_Card_Struct));
#  137|      dir_foreach(drm_dir, predicate_cardN, do_one_card, accumulator, d);
#  138|->    bool has_card_subdir = accumulator->has_card_connector_dir;
#  139|      free(accumulator);
#  140|      DBGF(debug, "Done.    Returning %s", sbool(has_card_subdir));

Error: CPPCHECK_WARNING (CWE-457): [#def835]
ddcutil-2.2.1/src/util/drm_card_connector_util.c:171: error[uninitvar]: Uninitialized variable: t0
#  169|      if (debug) {
#  170|        t1 = cur_realtime_nanosec();
#  171|->      DBG("elapsed: %jd microsec",  NANOS2MICROS(t1-t0));
#  172|      }
#  173|      DBGF(debug, "Done.     Returning %s", sbool(result));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def836]
ddcutil-2.2.1/src/util/edid.c:62:8: warning[-Wanalyzer-malloc-leak]: leak of 'create_parsed_edid(edidbytes)'
ddcutil-2.2.1/src/util/edid.c:297:15: enter_function: entry to 'create_parsed_edid2'
ddcutil-2.2.1/src/util/edid.c:298:25: call_function: calling 'create_parsed_edid' from 'create_parsed_edid2'
ddcutil-2.2.1/src/util/edid.c:298:25: return_function: returning to 'create_parsed_edid2' from 'create_parsed_edid'
ddcutil-2.2.1/src/util/edid.c:299:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/edid.c:300:7: branch_true: ...to here
ddcutil-2.2.1/src/util/edid.c:62:8: danger: 'create_parsed_edid(edidbytes)' leaks here; was allocated at [(20)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/19)
#   60|   
#   61|      const Byte edid_header_tag[] = {0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00};
#   62|->    if (memcmp(edidbytes, edid_header_tag, 8) != 0) {
#   63|         if (debug) {
#   64|            char * hs = hexstring(edidbytes,8);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def837]
ddcutil-2.2.1/src/util/edid.c:199:13: warning[-Wanalyzer-malloc-leak]: leak of 'parsed_edid'
ddcutil-2.2.1/src/util/edid.c:223:15: enter_function: entry to 'create_parsed_edid'
ddcutil-2.2.1/src/util/edid.c:231:18: acquire_memory: allocated here
ddcutil-2.2.1/src/util/edid.c:236:4: call_function: calling 'get_edid_mfg_id_in_buffer' from 'create_parsed_edid'
ddcutil-2.2.1/src/util/edid.c:236:4: return_function: returning to 'create_parsed_edid' from 'get_edid_mfg_id_in_buffer'
ddcutil-2.2.1/src/util/edid.c:248:4: call_function: calling 'get_edid_descriptor_strings' from 'create_parsed_edid'
#  197|               }
#  198|               nameslot[offset] = '\0';
#  199|->             rtrim_in_place(nameslot);   // handle no terminating LF but blank padded
#  200|               if (debug)
#  201|                  printf("(%s) name = %s\n", __func__, nameslot);

Error: CPPCHECK_WARNING (CWE-476): [#def838]
ddcutil-2.2.1/src/util/edid.c:233: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  231|      parsed_edid = calloc(1,sizeof(Parsed_Edid));
#  232|      assert(sizeof(parsed_edid->bytes) == 128);
#  233|->    memcpy(parsed_edid->marker, EDID_MARKER_NAME, 4);
#  234|      memcpy(parsed_edid->bytes,  edidbytes, 128);
#  235|   

Error: CPPCHECK_WARNING (CWE-476): [#def839]
ddcutil-2.2.1/src/util/edid.c:234: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  232|      assert(sizeof(parsed_edid->bytes) == 128);
#  233|      memcpy(parsed_edid->marker, EDID_MARKER_NAME, 4);
#  234|->    memcpy(parsed_edid->bytes,  edidbytes, 128);
#  235|   
#  236|      get_edid_mfg_id_in_buffer(

Error: CPPCHECK_WARNING (CWE-476): [#def840]
ddcutil-2.2.1/src/util/edid.c:238: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  236|      get_edid_mfg_id_in_buffer(
#  237|              edidbytes,
#  238|->            parsed_edid->mfg_id,
#  239|              sizeof(parsed_edid->mfg_id) );
#  240|   

Error: CPPCHECK_WARNING (CWE-476): [#def841]
ddcutil-2.2.1/src/util/edid.c:241: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  239|              sizeof(parsed_edid->mfg_id) );
#  240|   
#  241|->    parsed_edid->product_code = edidbytes[0x0b] << 8 | edidbytes[0x0a];
#  242|   
#  243|      parsed_edid->serial_binary = edidbytes[0x0c]       |

Error: GCC_ANALYZER_WARNING (CWE-476): [#def842]
ddcutil-2.2.1/src/util/edid.c:241:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'parsed_edid'
ddcutil-2.2.1/src/util/edid.c:223:15: enter_function: entry to 'create_parsed_edid'
ddcutil-2.2.1/src/util/edid.c:231:18: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/edid.c:236:4: call_function: calling 'get_edid_mfg_id_in_buffer' from 'create_parsed_edid'
ddcutil-2.2.1/src/util/edid.c:236:4: return_function: returning to 'create_parsed_edid' from 'get_edid_mfg_id_in_buffer'
ddcutil-2.2.1/src/util/edid.c:241:4: danger: 'parsed_edid' could be NULL: unchecked value from [(2)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/1)
#  239|              sizeof(parsed_edid->mfg_id) );
#  240|   
#  241|->    parsed_edid->product_code = edidbytes[0x0b] << 8 | edidbytes[0x0a];
#  242|   
#  243|      parsed_edid->serial_binary = edidbytes[0x0c]       |

Error: CPPCHECK_WARNING (CWE-476): [#def843]
ddcutil-2.2.1/src/util/edid.c:243: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  241|      parsed_edid->product_code = edidbytes[0x0b] << 8 | edidbytes[0x0a];
#  242|   
#  243|->    parsed_edid->serial_binary = edidbytes[0x0c]       |
#  244|                                   edidbytes[0x0d] <<  8 |
#  245|                                   edidbytes[0x0e] << 16 |

Error: CPPCHECK_WARNING (CWE-476): [#def844]
ddcutil-2.2.1/src/util/edid.c:250: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  248|      get_edid_descriptor_strings(
#  249|              edidbytes,
#  250|->            parsed_edid->model_name,   sizeof(parsed_edid->model_name),
#  251|              parsed_edid->serial_ascii, sizeof(parsed_edid->serial_ascii),
#  252|              parsed_edid->extra_descriptor_string, sizeof(parsed_edid->extra_descriptor_string)

Error: CPPCHECK_WARNING (CWE-476): [#def845]
ddcutil-2.2.1/src/util/edid.c:251: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  249|              edidbytes,
#  250|              parsed_edid->model_name,   sizeof(parsed_edid->model_name),
#  251|->            parsed_edid->serial_ascii, sizeof(parsed_edid->serial_ascii),
#  252|              parsed_edid->extra_descriptor_string, sizeof(parsed_edid->extra_descriptor_string)
#  253|              );

Error: CPPCHECK_WARNING (CWE-476): [#def846]
ddcutil-2.2.1/src/util/edid.c:252: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  250|              parsed_edid->model_name,   sizeof(parsed_edid->model_name),
#  251|              parsed_edid->serial_ascii, sizeof(parsed_edid->serial_ascii),
#  252|->            parsed_edid->extra_descriptor_string, sizeof(parsed_edid->extra_descriptor_string)
#  253|              );
#  254|   

Error: CPPCHECK_WARNING (CWE-476): [#def847]
ddcutil-2.2.1/src/util/edid.c:255: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  253|              );
#  254|   
#  255|->    parsed_edid->year = edidbytes[17] + 1990;
#  256|      parsed_edid->is_model_year = edidbytes[16] == 0xff;
#  257|      parsed_edid->manufacture_week = edidbytes[16];

Error: CPPCHECK_WARNING (CWE-476): [#def848]
ddcutil-2.2.1/src/util/edid.c:256: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  254|   
#  255|      parsed_edid->year = edidbytes[17] + 1990;
#  256|->    parsed_edid->is_model_year = edidbytes[16] == 0xff;
#  257|      parsed_edid->manufacture_week = edidbytes[16];
#  258|      parsed_edid->edid_version_major = edidbytes[18];

Error: CPPCHECK_WARNING (CWE-476): [#def849]
ddcutil-2.2.1/src/util/edid.c:257: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  255|      parsed_edid->year = edidbytes[17] + 1990;
#  256|      parsed_edid->is_model_year = edidbytes[16] == 0xff;
#  257|->    parsed_edid->manufacture_week = edidbytes[16];
#  258|      parsed_edid->edid_version_major = edidbytes[18];
#  259|      parsed_edid->edid_version_minor = edidbytes[19];

Error: CPPCHECK_WARNING (CWE-476): [#def850]
ddcutil-2.2.1/src/util/edid.c:258: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  256|      parsed_edid->is_model_year = edidbytes[16] == 0xff;
#  257|      parsed_edid->manufacture_week = edidbytes[16];
#  258|->    parsed_edid->edid_version_major = edidbytes[18];
#  259|      parsed_edid->edid_version_minor = edidbytes[19];
#  260|   

Error: CPPCHECK_WARNING (CWE-476): [#def851]
ddcutil-2.2.1/src/util/edid.c:259: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  257|      parsed_edid->manufacture_week = edidbytes[16];
#  258|      parsed_edid->edid_version_major = edidbytes[18];
#  259|->    parsed_edid->edid_version_minor = edidbytes[19];
#  260|   
#  261|      parsed_edid->rx = edidbytes[0x1b] << 2 | ( (edidbytes[0x19]&0b11000000)>>6 );

Error: CPPCHECK_WARNING (CWE-476): [#def852]
ddcutil-2.2.1/src/util/edid.c:261: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  259|      parsed_edid->edid_version_minor = edidbytes[19];
#  260|   
#  261|->    parsed_edid->rx = edidbytes[0x1b] << 2 | ( (edidbytes[0x19]&0b11000000)>>6 );
#  262|      parsed_edid->ry = edidbytes[0x1c] << 2 | ( (edidbytes[0x19]&0b00110000)>>4 );
#  263|      parsed_edid->gx = edidbytes[0x1d] << 2 | ( (edidbytes[0x19]&0b00001100)>>2 );

Error: CPPCHECK_WARNING (CWE-476): [#def853]
ddcutil-2.2.1/src/util/edid.c:262: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  260|   
#  261|      parsed_edid->rx = edidbytes[0x1b] << 2 | ( (edidbytes[0x19]&0b11000000)>>6 );
#  262|->    parsed_edid->ry = edidbytes[0x1c] << 2 | ( (edidbytes[0x19]&0b00110000)>>4 );
#  263|      parsed_edid->gx = edidbytes[0x1d] << 2 | ( (edidbytes[0x19]&0b00001100)>>2 );
#  264|      parsed_edid->gy = edidbytes[0x1e] << 2 | ( (edidbytes[0x19]&0b00000011)>>0 );

Error: CPPCHECK_WARNING (CWE-476): [#def854]
ddcutil-2.2.1/src/util/edid.c:263: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  261|      parsed_edid->rx = edidbytes[0x1b] << 2 | ( (edidbytes[0x19]&0b11000000)>>6 );
#  262|      parsed_edid->ry = edidbytes[0x1c] << 2 | ( (edidbytes[0x19]&0b00110000)>>4 );
#  263|->    parsed_edid->gx = edidbytes[0x1d] << 2 | ( (edidbytes[0x19]&0b00001100)>>2 );
#  264|      parsed_edid->gy = edidbytes[0x1e] << 2 | ( (edidbytes[0x19]&0b00000011)>>0 );
#  265|      parsed_edid->bx = edidbytes[0x1f] << 2 | ( (edidbytes[0x1a]&0b11000000)>>6 );

Error: CPPCHECK_WARNING (CWE-476): [#def855]
ddcutil-2.2.1/src/util/edid.c:264: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  262|      parsed_edid->ry = edidbytes[0x1c] << 2 | ( (edidbytes[0x19]&0b00110000)>>4 );
#  263|      parsed_edid->gx = edidbytes[0x1d] << 2 | ( (edidbytes[0x19]&0b00001100)>>2 );
#  264|->    parsed_edid->gy = edidbytes[0x1e] << 2 | ( (edidbytes[0x19]&0b00000011)>>0 );
#  265|      parsed_edid->bx = edidbytes[0x1f] << 2 | ( (edidbytes[0x1a]&0b11000000)>>6 );
#  266|      parsed_edid->by = edidbytes[0x20] << 2 | ( (edidbytes[0x1a]&0b00110000)>>4 );

Error: CPPCHECK_WARNING (CWE-476): [#def856]
ddcutil-2.2.1/src/util/edid.c:265: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  263|      parsed_edid->gx = edidbytes[0x1d] << 2 | ( (edidbytes[0x19]&0b00001100)>>2 );
#  264|      parsed_edid->gy = edidbytes[0x1e] << 2 | ( (edidbytes[0x19]&0b00000011)>>0 );
#  265|->    parsed_edid->bx = edidbytes[0x1f] << 2 | ( (edidbytes[0x1a]&0b11000000)>>6 );
#  266|      parsed_edid->by = edidbytes[0x20] << 2 | ( (edidbytes[0x1a]&0b00110000)>>4 );
#  267|      parsed_edid->wx = edidbytes[0x21] << 2 | ( (edidbytes[0x1a]&0b00001100)>>2 );

Error: CPPCHECK_WARNING (CWE-476): [#def857]
ddcutil-2.2.1/src/util/edid.c:266: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  264|      parsed_edid->gy = edidbytes[0x1e] << 2 | ( (edidbytes[0x19]&0b00000011)>>0 );
#  265|      parsed_edid->bx = edidbytes[0x1f] << 2 | ( (edidbytes[0x1a]&0b11000000)>>6 );
#  266|->    parsed_edid->by = edidbytes[0x20] << 2 | ( (edidbytes[0x1a]&0b00110000)>>4 );
#  267|      parsed_edid->wx = edidbytes[0x21] << 2 | ( (edidbytes[0x1a]&0b00001100)>>2 );
#  268|   // parsed_edid->wy = edidbytes[0x22] << 2 | ( (edidbytes[0x1a]&0b00000011)>>0 );

Error: CPPCHECK_WARNING (CWE-476): [#def858]
ddcutil-2.2.1/src/util/edid.c:267: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  265|      parsed_edid->bx = edidbytes[0x1f] << 2 | ( (edidbytes[0x1a]&0b11000000)>>6 );
#  266|      parsed_edid->by = edidbytes[0x20] << 2 | ( (edidbytes[0x1a]&0b00110000)>>4 );
#  267|->    parsed_edid->wx = edidbytes[0x21] << 2 | ( (edidbytes[0x1a]&0b00001100)>>2 );
#  268|   // parsed_edid->wy = edidbytes[0x22] << 2 | ( (edidbytes[0x1a]&0b00000011)>>0 );
#  269|   // low order digits wrong, try another way

Error: CPPCHECK_WARNING (CWE-476): [#def859]
ddcutil-2.2.1/src/util/edid.c:270: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  268|   // parsed_edid->wy = edidbytes[0x22] << 2 | ( (edidbytes[0x1a]&0b00000011)>>0 );
#  269|   // low order digits wrong, try another way
#  270|->    parsed_edid->wy = edidbytes[0x22] * 4 + ((edidbytes[0x1a]&0b00000011)>>0);
#  271|   
#  272|      parsed_edid->video_input_definition = edidbytes[0x14];

Error: CPPCHECK_WARNING (CWE-476): [#def860]
ddcutil-2.2.1/src/util/edid.c:272: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  270|      parsed_edid->wy = edidbytes[0x22] * 4 + ((edidbytes[0x1a]&0b00000011)>>0);
#  271|   
#  272|->    parsed_edid->video_input_definition = edidbytes[0x14];
#  273|      // printf("(%s) video_input_parms_bitmap = 0x%02x\n", __func__, video_input_parms_bitmap);
#  274|      // parsed_edid->is_digital_input = (parsed_edid->video_input_definition & 0x80) ? true : false;

Error: CPPCHECK_WARNING (CWE-476): [#def861]
ddcutil-2.2.1/src/util/edid.c:276: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  274|      // parsed_edid->is_digital_input = (parsed_edid->video_input_definition & 0x80) ? true : false;
#  275|   
#  276|->    parsed_edid->supported_features = edidbytes[0x18];
#  277|      parsed_edid->extension_flag = edidbytes[0x7e];
#  278|   

Error: CPPCHECK_WARNING (CWE-476): [#def862]
ddcutil-2.2.1/src/util/edid.c:277: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parsed_edid
#  275|   
#  276|      parsed_edid->supported_features = edidbytes[0x18];
#  277|->    parsed_edid->extension_flag = edidbytes[0x7e];
#  278|   
#  279|   bye:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def863]
ddcutil-2.2.1/src/util/edid.c:377:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/util/edid.c:370:19: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/edid.c:373:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/edid.c:376:10: branch_true: ...to here
ddcutil-2.2.1/src/util/edid.c:376:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/edid.c:377:17: branch_true: ...to here
ddcutil-2.2.1/src/util/edid.c:377:10: danger: 'result + (sizetype)respos' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0)
#  375|         bool is_printable = s[ndx] >=32 && s[ndx] < 128 ;
#  376|         if ( is_printable) {
#  377|->          result[respos++] = s[ndx];
#  378|         }
#  379|         else {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def864]
ddcutil-2.2.1/src/util/edid.c:380:10: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'result' where non-null expected
ddcutil-2.2.1/src/util/edid.c:370:19: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/edid.c:373:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/edid.c:376:10: branch_true: ...to here
ddcutil-2.2.1/src/util/edid.c:376:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/edid.c:380:44: branch_false: ...to here
ddcutil-2.2.1/src/util/edid.c:380:10: danger: argument 1 ('result + (sizetype)respos') from [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
#argument 1 of '__builtin_sprintf' must be non-null
#  378|         }
#  379|         else {
#  380|->          sprintf(result+respos, "<x%02x>", (unsigned char) s[ndx]);
#  381|            respos += 5;
#  382|         }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def865]
ddcutil-2.2.1/src/util/edid.c:385:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/util/edid.c:370:19: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/edid.c:373:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/edid.c:385:10: branch_false: ...to here
ddcutil-2.2.1/src/util/edid.c:385:4: danger: 'result + (sizetype)respos' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/0)
#  383|         ndx++;
#  384|      }
#  385|->    result[respos] = '\0';
#  386|      // printf("respos=%d, reqd=%d\n", respos, reqd);
#  387|      assert(respos == (reqd-1));

Error: GCC_ANALYZER_WARNING (CWE-401): [#def866]
ddcutil-2.2.1/src/util/edid.c:406:17: warning[-Wanalyzer-malloc-leak]: leak of 'base_asciify(s)'
ddcutil-2.2.1/src/util/edid.c:401:8: enter_function: entry to 'base_asciify_t'
ddcutil-2.2.1/src/util/edid.c:405:21: call_function: calling 'base_asciify' from 'base_asciify_t'
ddcutil-2.2.1/src/util/edid.c:405:21: return_function: returning to 'base_asciify_t' from 'base_asciify'
ddcutil-2.2.1/src/util/edid.c:406:17: danger: 'base_asciify(s)' leaks here; was allocated at [(4)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/3)
#  404|   
#  405|      char * buftemp = base_asciify(s);
#  406|->    char * buf = get_thread_dynamic_buffer(&x_key, &x_len_key, strlen(s)+1);
#  407|      strcpy(buf, buftemp);
#  408|      free(buftemp);

Error: CPPCHECK_WARNING (CWE-476): [#def867]
ddcutil-2.2.1/src/util/error_info.c:294: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new
#  292|   
#  293|      Error_Info * new = calloc(1, sizeof(Error_Info));
#  294|->    memcpy(new->marker, old->marker, 4);
#  295|      new->status_code = old->status_code;
#  296|      if (old->func)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def868]
ddcutil-2.2.1/src/util/error_info.c:294:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'new'
ddcutil-2.2.1/src/util/error_info.c:555:14: enter_function: entry to 'errinfo_new_with_causes_gptr'
ddcutil-2.2.1/src/util/error_info.c:567:26: call_function: calling 'errinfo_newv' from 'errinfo_new_with_causes_gptr'
ddcutil-2.2.1/src/util/error_info.c:567:26: return_function: returning to 'errinfo_new_with_causes_gptr' from 'errinfo_newv'
ddcutil-2.2.1/src/util/error_info.c:569:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/error_info.c:570:49: branch_true: ...to here
ddcutil-2.2.1/src/util/error_info.c:570:10: call_function: calling 'errinfo_copy' from 'errinfo_new_with_causes_gptr'
#  292|   
#  293|      Error_Info * new = calloc(1, sizeof(Error_Info));
#  294|->    memcpy(new->marker, old->marker, 4);
#  295|      new->status_code = old->status_code;
#  296|      if (old->func)

Error: CPPCHECK_WARNING (CWE-476): [#def869]
ddcutil-2.2.1/src/util/error_info.c:295: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new
#  293|      Error_Info * new = calloc(1, sizeof(Error_Info));
#  294|      memcpy(new->marker, old->marker, 4);
#  295|->    new->status_code = old->status_code;
#  296|      if (old->func)
#  297|       new->func = g_strdup(old->func);

Error: CPPCHECK_WARNING (CWE-476): [#def870]
ddcutil-2.2.1/src/util/error_info.c:300: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new
#  298|      if (old->detail)
#  299|         new->detail = g_strdup(old->detail);
#  300|->    new->max_causes = old->max_causes;
#  301|      new->cause_ct = old->cause_ct;
#  302|      if (new->cause_ct == 0)

Error: CPPCHECK_WARNING (CWE-476): [#def871]
ddcutil-2.2.1/src/util/error_info.c:301: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new
#  299|         new->detail = g_strdup(old->detail);
#  300|      new->max_causes = old->max_causes;
#  301|->    new->cause_ct = old->cause_ct;
#  302|      if (new->cause_ct == 0)
#  303|         new->causes = empty_list;

Error: CPPCHECK_WARNING (CWE-476): [#def872]
ddcutil-2.2.1/src/util/error_info.c:302: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new
#  300|      new->max_causes = old->max_causes;
#  301|      new->cause_ct = old->cause_ct;
#  302|->    if (new->cause_ct == 0)
#  303|         new->causes = empty_list;
#  304|      else {

Error: CPPCHECK_WARNING (CWE-476): [#def873]
ddcutil-2.2.1/src/util/error_info.c:308: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new
#  306|         DBGF(debug, "Allocated new->causes=%p, new->cause_ct=%d", (void*) new->causes, new->cause_ct);
#  307|      }
#  308|->    for (int ndx = 0; ndx < new->cause_ct; ndx++) {
#  309|         new->causes[ndx] = errinfo_copy(old->causes[ndx]);
#  310|      }

Error: CPPCHECK_WARNING (CWE-476): [#def874]
ddcutil-2.2.1/src/util/error_info.c:309: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new
#  307|      }
#  308|      for (int ndx = 0; ndx < new->cause_ct; ndx++) {
#  309|->       new->causes[ndx] = errinfo_copy(old->causes[ndx]);
#  310|      }
#  311|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def875]
ddcutil-2.2.1/src/util/error_info.c:329:4: warning[-Wanalyzer-malloc-leak]: leak of 'errinfo_newv(status_code,  func,  detail, & ap)'
ddcutil-2.2.1/src/util/error_info.c:524:1: enter_function: entry to 'errinfo_new_with_causes'
ddcutil-2.2.1/src/util/error_info.c:534:26: call_function: calling 'errinfo_newv' from 'errinfo_new_with_causes'
ddcutil-2.2.1/src/util/error_info.c:534:26: return_function: returning to 'errinfo_new_with_causes' from 'errinfo_newv'
ddcutil-2.2.1/src/util/error_info.c:536:22: branch_true: following 'true' branch (when 'ndx < cause_ct')...
ddcutil-2.2.1/src/util/error_info.c:537:39: branch_true: ...to here
ddcutil-2.2.1/src/util/error_info.c:537:7: call_function: calling 'errinfo_add_cause' from 'errinfo_new_with_causes'
#  327|      bool debug = false;
#  328|      DBGF(debug, "parent=%p, cause=%p", parent, cause);
#  329|->    VALID_ERROR_INFO_PTR(parent);
#  330|      VALID_ERROR_INFO_PTR(cause);
#  331|      DBGF(debug, "parent->cause_ct = %d, parent->max_causes = %d",

Error: GCC_ANALYZER_WARNING (CWE-401): [#def876]
ddcutil-2.2.1/src/util/error_info.c:330:4: warning[-Wanalyzer-malloc-leak]: leak of 'errinfo_newv(status_code,  func,  detail, & ap)'
ddcutil-2.2.1/src/util/error_info.c:524:1: enter_function: entry to 'errinfo_new_with_causes'
ddcutil-2.2.1/src/util/error_info.c:534:26: call_function: calling 'errinfo_newv' from 'errinfo_new_with_causes'
ddcutil-2.2.1/src/util/error_info.c:534:26: return_function: returning to 'errinfo_new_with_causes' from 'errinfo_newv'
ddcutil-2.2.1/src/util/error_info.c:536:22: branch_true: following 'true' branch (when 'ndx < cause_ct')...
ddcutil-2.2.1/src/util/error_info.c:537:39: branch_true: ...to here
ddcutil-2.2.1/src/util/error_info.c:537:7: call_function: calling 'errinfo_add_cause' from 'errinfo_new_with_causes'
#  328|      DBGF(debug, "parent=%p, cause=%p", parent, cause);
#  329|      VALID_ERROR_INFO_PTR(parent);
#  330|->    VALID_ERROR_INFO_PTR(cause);
#  331|      DBGF(debug, "parent->cause_ct = %d, parent->max_causes = %d",
#  332|                  parent->cause_ct, parent->max_causes);

Error: CPPCHECK_WARNING (CWE-476): [#def877]
ddcutil-2.2.1/src/util/error_info.c:350: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_causes
#  348|            // parent->causes = reallocarray(parent->causes, new_max+1, sizeof(Error_Info*) );
#  349|            void * new_causes = calloc(new_max+1, sizeof(Error_Info*) );
#  350|->          memcpy(new_causes, parent->causes, parent->max_causes * sizeof(Error_Info *) );
#  351|            free(parent->causes);
#  352|            parent->causes = new_causes;

Error: CPPCHECK_WARNING (CWE-476): [#def878]
ddcutil-2.2.1/src/util/error_info.c:399: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: erec
#  397|   
#  398|      Error_Info * erec = calloc(1, sizeof(Error_Info));
#  399|->    memcpy(erec->marker, ERROR_INFO_MARKER, 4);
#  400|      erec->status_code = status_code;
#  401|      erec->causes = empty_list;

Error: CPPCHECK_WARNING (CWE-476): [#def879]
ddcutil-2.2.1/src/util/error_info.c:400: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: erec
#  398|      Error_Info * erec = calloc(1, sizeof(Error_Info));
#  399|      memcpy(erec->marker, ERROR_INFO_MARKER, 4);
#  400|->    erec->status_code = status_code;
#  401|      erec->causes = empty_list;
#  402|      erec->func = g_strdup(func);   // g_strdup to avoid constness warning, must free

Error: GCC_ANALYZER_WARNING (CWE-476): [#def880]
ddcutil-2.2.1/src/util/error_info.c:400:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'erec'
ddcutil-2.2.1/src/util/error_info.c:555:14: enter_function: entry to 'errinfo_new_with_causes_gptr'
ddcutil-2.2.1/src/util/error_info.c:567:26: call_function: calling 'errinfo_newv' from 'errinfo_new_with_causes_gptr'
#  398|      Error_Info * erec = calloc(1, sizeof(Error_Info));
#  399|      memcpy(erec->marker, ERROR_INFO_MARKER, 4);
#  400|->    erec->status_code = status_code;
#  401|      erec->causes = empty_list;
#  402|      erec->func = g_strdup(func);   // g_strdup to avoid constness warning, must free

Error: CPPCHECK_WARNING (CWE-476): [#def881]
ddcutil-2.2.1/src/util/error_info.c:401: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: erec
#  399|      memcpy(erec->marker, ERROR_INFO_MARKER, 4);
#  400|      erec->status_code = status_code;
#  401|->    erec->causes = empty_list;
#  402|      erec->func = g_strdup(func);   // g_strdup to avoid constness warning, must free
#  403|   

Error: CPPCHECK_WARNING (CWE-476): [#def882]
ddcutil-2.2.1/src/util/error_info.c:402: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: erec
#  400|      erec->status_code = status_code;
#  401|      erec->causes = empty_list;
#  402|->    erec->func = g_strdup(func);   // g_strdup to avoid constness warning, must free
#  403|   
#  404|      if (detail) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def883]
ddcutil-2.2.1/src/util/error_info.c:405:22: warning[-Wanalyzer-malloc-leak]: leak of 'erec'
ddcutil-2.2.1/src/util/error_info.c:555:14: enter_function: entry to 'errinfo_new_with_causes_gptr'
ddcutil-2.2.1/src/util/error_info.c:567:26: call_function: calling 'errinfo_newv' from 'errinfo_new_with_causes_gptr'
#  403|   
#  404|      if (detail) {
#  405|->       erec->detail = g_strdup_vprintf(detail, args);
#  406|      }
#  407|   

Error: GCC_ANALYZER_WARNING (CWE-404): [#def884]
ddcutil-2.2.1/src/util/error_info.c:405:22: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
ddcutil-2.2.1/src/util/error_info.c:555:14: enter_function: entry to 'errinfo_new_with_causes_gptr'
ddcutil-2.2.1/src/util/error_info.c:566:4: acquire_resource: 'va_start' called here
ddcutil-2.2.1/src/util/error_info.c:567:26: call_function: calling 'errinfo_newv' from 'errinfo_new_with_causes_gptr'
#  403|   
#  404|      if (detail) {
#  405|->       erec->detail = g_strdup_vprintf(detail, args);
#  406|      }
#  407|   

Error: GCC_ANALYZER_WARNING (CWE-775): [#def885]
ddcutil-2.2.1/src/util/file_util.c:96:37: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(fn, "r")'
ddcutil-2.2.1/src/util/file_util.c:88:16: acquire_resource: opened here
ddcutil-2.2.1/src/util/file_util.c:89:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:96:37: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:96:37: danger: 'fopen(fn, "r")' leaks here; was opened at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   94|      }
#   95|      else {
#   96|->       Circular_String_Buffer* csb = csb_new(maxlines);
#   97|         // if line == NULL && len == 0, then getline allocates buffer for line
#   98|         char * line = NULL;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def886]
ddcutil-2.2.1/src/util/file_util.c:96:37: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(fn, "r")'
ddcutil-2.2.1/src/util/file_util.c:88:16: acquire_memory: allocated here
ddcutil-2.2.1/src/util/file_util.c:89:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:96:37: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:96:37: danger: 'fopen(fn, "r")' leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#   94|      }
#   95|      else {
#   96|->       Circular_String_Buffer* csb = csb_new(maxlines);
#   97|         // if line == NULL && len == 0, then getline allocates buffer for line
#   98|         char * line = NULL;

Error: GCC_ANALYZER_WARNING (CWE-775): [#def887]
ddcutil-2.2.1/src/util/file_util.c:224:17: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(fn, "r")'
ddcutil-2.2.1/src/util/file_util.c:204:4: branch_false: following 'false' branch (when 'fn' is non-NULL)...
ddcutil-2.2.1/src/util/file_util.c:215:15: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:215:15: acquire_resource: opened here
ddcutil-2.2.1/src/util/file_util.c:215:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:223:7: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:223:7: branch_true: following 'true' branch (when 'est_size <= 0')...
ddcutil-2.2.1/src/util/file_util.c:224:17: branch_true: ...to here
ddcutil-2.2.1/src/util/file_util.c:224:17: danger: 'fopen(fn, "r")' leaks here; was opened at [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
#  222|   
#  223|      if (est_size <= 0)
#  224|->       gbarray = g_byte_array_new();
#  225|      else
#  226|         gbarray = g_byte_array_sized_new(est_size);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def888]
ddcutil-2.2.1/src/util/file_util.c:224:17: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(fn, "r")'
ddcutil-2.2.1/src/util/file_util.c:204:4: branch_false: following 'false' branch (when 'fn' is non-NULL)...
ddcutil-2.2.1/src/util/file_util.c:215:15: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:215:15: acquire_memory: allocated here
ddcutil-2.2.1/src/util/file_util.c:215:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:223:7: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:223:7: branch_true: following 'true' branch (when 'est_size <= 0')...
ddcutil-2.2.1/src/util/file_util.c:224:17: branch_true: ...to here
ddcutil-2.2.1/src/util/file_util.c:224:17: danger: 'fopen(fn, "r")' leaks here; was allocated at [(3)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/2)
#  222|   
#  223|      if (est_size <= 0)
#  224|->       gbarray = g_byte_array_new();
#  225|      else
#  226|         gbarray = g_byte_array_sized_new(est_size);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def889]
ddcutil-2.2.1/src/util/file_util.c:226:17: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(fn, "r")'
ddcutil-2.2.1/src/util/file_util.c:204:4: branch_false: following 'false' branch (when 'fn' is non-NULL)...
ddcutil-2.2.1/src/util/file_util.c:215:15: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:215:15: acquire_resource: opened here
ddcutil-2.2.1/src/util/file_util.c:215:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:223:7: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:223:7: branch_false: following 'false' branch (when 'est_size > 0')...
ddcutil-2.2.1/src/util/file_util.c:226:17: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:226:17: danger: 'fopen(fn, "r")' leaks here; was opened at [(3)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/2)
#  224|         gbarray = g_byte_array_new();
#  225|      else
#  226|->       gbarray = g_byte_array_sized_new(est_size);
#  227|   
#  228|      // TODO: read bigger hunks

Error: GCC_ANALYZER_WARNING (CWE-401): [#def890]
ddcutil-2.2.1/src/util/file_util.c:226:17: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(fn, "r")'
ddcutil-2.2.1/src/util/file_util.c:204:4: branch_false: following 'false' branch (when 'fn' is non-NULL)...
ddcutil-2.2.1/src/util/file_util.c:215:15: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:215:15: acquire_memory: allocated here
ddcutil-2.2.1/src/util/file_util.c:215:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:223:7: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:223:7: branch_false: following 'false' branch (when 'est_size > 0')...
ddcutil-2.2.1/src/util/file_util.c:226:17: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:226:17: danger: 'fopen(fn, "r")' leaks here; was allocated at [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2)
#  224|         gbarray = g_byte_array_new();
#  225|      else
#  226|->       gbarray = g_byte_array_sized_new(est_size);
#  227|   
#  228|      // TODO: read bigger hunks

Error: GCC_ANALYZER_WARNING (CWE-775): [#def891]
ddcutil-2.2.1/src/util/file_util.c:232:7: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(fn, "r")'
ddcutil-2.2.1/src/util/file_util.c:204:4: branch_false: following 'false' branch (when 'fn' is non-NULL)...
ddcutil-2.2.1/src/util/file_util.c:215:15: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:215:15: acquire_resource: opened here
ddcutil-2.2.1/src/util/file_util.c:215:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:223:7: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:230:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/file_util.c:231:7: branch_true: ...to here
ddcutil-2.2.1/src/util/file_util.c:231:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:232:7: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:232:7: danger: 'fopen(fn, "r")' leaks here; was opened at [(3)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/2)
#  230|      while ( (ct = fread(buf, /*size*/ 1, /*nmemb*/ 1, fp) ) > 0) {
#  231|         assert(ct == 1);
#  232|->       g_byte_array_append(gbarray, buf, ct);
#  233|      }
#  234|      fclose(fp);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def892]
ddcutil-2.2.1/src/util/file_util.c:232:7: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(fn, "r")'
ddcutil-2.2.1/src/util/file_util.c:204:4: branch_false: following 'false' branch (when 'fn' is non-NULL)...
ddcutil-2.2.1/src/util/file_util.c:215:15: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:215:15: acquire_memory: allocated here
ddcutil-2.2.1/src/util/file_util.c:215:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:223:7: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:230:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/file_util.c:231:7: branch_true: ...to here
ddcutil-2.2.1/src/util/file_util.c:231:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:232:7: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:232:7: danger: 'fopen(fn, "r")' leaks here; was allocated at [(3)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/2)
#  230|      while ( (ct = fread(buf, /*size*/ 1, /*nmemb*/ 1, fp) ) > 0) {
#  231|         assert(ct == 1);
#  232|->       g_byte_array_append(gbarray, buf, ct);
#  233|      }
#  234|      fclose(fp);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def893]
ddcutil-2.2.1/src/util/file_util.c:270:6: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(filename, "rb")'
ddcutil-2.2.1/src/util/file_util.c:262:16: acquire_resource: opened here
ddcutil-2.2.1/src/util/file_util.c:263:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:270:6: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:270:6: danger: 'fopen(filename, "rb")' leaks here; was opened at [(1)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/0)
#  268|   
#  269|      if (fp) {
#  270|->      fseek (fp, 0, SEEK_END);
#  271|        length = ftell (fp);
#  272|        if (length < 0) {       // make coverity happy

Error: GCC_ANALYZER_WARNING (CWE-401): [#def894]
ddcutil-2.2.1/src/util/file_util.c:270:6: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(filename, "rb")'
ddcutil-2.2.1/src/util/file_util.c:262:16: acquire_memory: allocated here
ddcutil-2.2.1/src/util/file_util.c:263:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:270:6: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:270:6: danger: 'fopen(filename, "rb")' leaks here; was allocated at [(1)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/0)
#  268|   
#  269|      if (fp) {
#  270|->      fseek (fp, 0, SEEK_END);
#  271|        length = ftell (fp);
#  272|        if (length < 0) {       // make coverity happy

Error: GCC_ANALYZER_WARNING (CWE-775): [#def895]
ddcutil-2.2.1/src/util/file_util.c:271:15: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(filename, "rb")'
ddcutil-2.2.1/src/util/file_util.c:262:16: acquire_resource: opened here
ddcutil-2.2.1/src/util/file_util.c:263:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:270:6: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:271:15: danger: 'fopen(filename, "rb")' leaks here; was opened at [(1)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/0)
#  269|      if (fp) {
#  270|        fseek (fp, 0, SEEK_END);
#  271|->      length = ftell (fp);
#  272|        if (length < 0) {       // make coverity happy
#  273|           if (verbose) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def896]
ddcutil-2.2.1/src/util/file_util.c:271:15: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(filename, "rb")'
ddcutil-2.2.1/src/util/file_util.c:262:16: acquire_memory: allocated here
ddcutil-2.2.1/src/util/file_util.c:263:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:270:6: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:271:15: danger: 'fopen(filename, "rb")' leaks here; was allocated at [(1)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/0)
#  269|      if (fp) {
#  270|        fseek (fp, 0, SEEK_END);
#  271|->      length = ftell (fp);
#  272|        if (length < 0) {       // make coverity happy
#  273|           if (verbose) {

Error: GCC_ANALYZER_WARNING (CWE-775): [#def897]
ddcutil-2.2.1/src/util/file_util.c:279:6: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(filename, "rb")'
ddcutil-2.2.1/src/util/file_util.c:262:16: acquire_resource: opened here
ddcutil-2.2.1/src/util/file_util.c:263:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:270:6: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:272:9: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:279:6: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:279:6: danger: 'fopen(filename, "rb")' leaks here; was opened at [(1)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/0)
#  277|           goto bye;
#  278|        }
#  279|->      fseek(fp, 0, SEEK_SET);
#  280|        buffer = malloc (length+1);
#  281|        assert(buffer);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def898]
ddcutil-2.2.1/src/util/file_util.c:279:6: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(filename, "rb")'
ddcutil-2.2.1/src/util/file_util.c:262:16: acquire_memory: allocated here
ddcutil-2.2.1/src/util/file_util.c:263:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:270:6: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:272:9: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:279:6: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:279:6: danger: 'fopen(filename, "rb")' leaks here; was allocated at [(1)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/0)
#  277|           goto bye;
#  278|        }
#  279|->      fseek(fp, 0, SEEK_SET);
#  280|        buffer = malloc (length+1);
#  281|        assert(buffer);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def899]
ddcutil-2.2.1/src/util/file_util.c:280:23: warning[-Wanalyzer-file-leak]: leak of FILE 'fopen(filename, "rb")'
ddcutil-2.2.1/src/util/file_util.c:262:16: acquire_resource: opened here
ddcutil-2.2.1/src/util/file_util.c:263:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:270:6: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:272:9: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:279:6: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:280:23: danger: 'fopen(filename, "rb")' leaks here; was opened at [(1)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/0)
#  278|        }
#  279|        fseek(fp, 0, SEEK_SET);
#  280|->      buffer = malloc (length+1);
#  281|        assert(buffer);
#  282|        size_t len1 = fread(buffer, 1, length, fp);   // len1 assignment to avoid unused result error

Error: GCC_ANALYZER_WARNING (CWE-401): [#def900]
ddcutil-2.2.1/src/util/file_util.c:280:23: warning[-Wanalyzer-malloc-leak]: leak of 'fopen(filename, "rb")'
ddcutil-2.2.1/src/util/file_util.c:262:16: acquire_memory: allocated here
ddcutil-2.2.1/src/util/file_util.c:263:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:270:6: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:272:9: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/file_util.c:279:6: branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:280:23: danger: 'fopen(filename, "rb")' leaks here; was allocated at [(1)](sarif:/runs/0/results/15/codeFlows/0/threadFlows/0/locations/0)
#  278|        }
#  279|        fseek(fp, 0, SEEK_SET);
#  280|->      buffer = malloc (length+1);
#  281|        assert(buffer);
#  282|        size_t len1 = fread(buffer, 1, length, fp);   // len1 assignment to avoid unused result error

Error: GCC_ANALYZER_WARNING (CWE-688): [#def901]
ddcutil-2.2.1/src/util/file_util.c:411:17: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'result' where non-null expected
ddcutil-2.2.1/src/util/file_util.c:404:20: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/file_util.c:411:17: danger: argument 2 ('result') from [(1)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/0) could be NULL where non-null expected
#  409|         printf("(%s) workbuf = |%s|\n", __func__, workbuf);
#  410|   
#  411|->    ssize_t ct = readlink(workbuf, result, PATH_MAX);
#  412|      if (debug) {
#  413|         char b0[100];

Error: GCC_ANALYZER_WARNING (CWE-401): [#def902]
ddcutil-2.2.1/src/util/file_util.c:496:22: warning[-Wanalyzer-malloc-leak]: leak of 'opendir(dirname)'
ddcutil-2.2.1/src/util/file_util.c:491:8: acquire_memory: allocated here
ddcutil-2.2.1/src/util/file_util.c:492:7: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:496:22: danger: 'opendir(dirname)' leaks here; was allocated at [(1)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/0)
#  494|      }
#  495|      else {
#  496|->       while ((dent = readdir(d)) != NULL) {
#  497|            // DBGMSG("%s", dent->d_name);
#  498|            if (!streq(dent->d_name, ".") && !streq(dent->d_name, "..") ) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def903]
ddcutil-2.2.1/src/util/file_util.c:525:22: warning[-Wanalyzer-malloc-leak]: leak of 'opendir(dirname)'
ddcutil-2.2.1/src/util/file_util.c:520:8: acquire_memory: allocated here
ddcutil-2.2.1/src/util/file_util.c:521:7: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:525:22: danger: 'opendir(dirname)' leaks here; was allocated at [(1)](sarif:/runs/0/results/20/codeFlows/0/threadFlows/0/locations/0)
#  523|      }
#  524|      else {
#  525|->       while ((dent = readdir(d)) != NULL) {
#  526|            // DBGMSG("%s", dent->d_name);
#  527|            if (!streq(dent->d_name, ".") && !streq(dent->d_name, "..") ) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def904]
ddcutil-2.2.1/src/util/file_util.c:568:22: warning[-Wanalyzer-malloc-leak]: leak of 'opendir(dirname)'
ddcutil-2.2.1/src/util/file_util.c:563:8: acquire_memory: allocated here
ddcutil-2.2.1/src/util/file_util.c:564:7: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:568:22: danger: 'opendir(dirname)' leaks here; was allocated at [(1)](sarif:/runs/0/results/21/codeFlows/0/threadFlows/0/locations/0)
#  566|      }
#  567|      else {
#  568|->       while ((dent = readdir(d)) != NULL) {
#  569|            // DBGMSG("%s", dent->d_name);
#  570|            if (!streq(dent->d_name, ".") && !streq(dent->d_name, "..") ) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def905]
ddcutil-2.2.1/src/util/file_util.c:615:22: warning[-Wanalyzer-malloc-leak]: leak of 'opendir(dirname)'
ddcutil-2.2.1/src/util/file_util.c:610:8: acquire_memory: allocated here
ddcutil-2.2.1/src/util/file_util.c:611:7: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:615:22: danger: 'opendir(dirname)' leaks here; was allocated at [(1)](sarif:/runs/0/results/22/codeFlows/0/threadFlows/0/locations/0)
#  613|      }
#  614|      else {
#  615|->       while ((dent = readdir(d)) != NULL) {
#  616|            if (debug)
#  617|               printf("(%s) %s\n", __func__, dent->d_name);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def906]
ddcutil-2.2.1/src/util/file_util.c:676:22: warning[-Wanalyzer-malloc-leak]: leak of 'opendir(dirname)'
ddcutil-2.2.1/src/util/file_util.c:671:8: acquire_memory: allocated here
ddcutil-2.2.1/src/util/file_util.c:672:7: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/util/file_util.c:676:22: danger: 'opendir(dirname)' leaks here; was allocated at [(1)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/0)
#  674|      }
#  675|      else {
#  676|->       while ((dent = readdir(d)) != NULL) {
#  677|            // DBGMSG("%s", dent->d_name);
#  678|            if (!streq(dent->d_name, ".") && !streq(dent->d_name, "..") ) {

Error: CPPCHECK_WARNING (CWE-476): [#def907]
ddcutil-2.2.1/src/util/glib_string_util.c:42: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pieces
#   40|         int ndx;
#   41|         for (ndx=0; ndx < ct; ndx++) {
#   42|->          pieces[ndx] = g_ptr_array_index(strings,ndx);
#   43|            if (debug)
#   44|               fprintf(stdout, "(%s) pieces[%d] = %s\n", __func__, ndx, pieces[ndx]);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def908]
ddcutil-2.2.1/src/util/glib_string_util.c:42:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'pieces'
ddcutil-2.2.1/src/util/glib_string_util.c:35:7: branch_true: following 'true' branch (when 'strings' is non-NULL)...
ddcutil-2.2.1/src/util/glib_string_util.c:36:16: branch_true: ...to here
ddcutil-2.2.1/src/util/glib_string_util.c:39:24: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/glib_string_util.c:41:19: branch_true: following 'true' branch (when 'ndx < ct')...
ddcutil-2.2.1/src/util/glib_string_util.c:42:24: branch_true: ...to here
ddcutil-2.2.1/src/util/glib_string_util.c:42:10: danger: 'pieces + (long unsigned int)ndx * 8' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#   40|         int ndx;
#   41|         for (ndx=0; ndx < ct; ndx++) {
#   42|->          pieces[ndx] = g_ptr_array_index(strings,ndx);
#   43|            if (debug)
#   44|               fprintf(stdout, "(%s) pieces[%d] = %s\n", __func__, ndx, pieces[ndx]);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def909]
ddcutil-2.2.1/src/util/glib_string_util.c:46:19: warning[-Wanalyzer-malloc-leak]: leak of 'pieces'
ddcutil-2.2.1/src/util/glib_string_util.c:35:7: branch_true: following 'true' branch (when 'strings' is non-NULL)...
ddcutil-2.2.1/src/util/glib_string_util.c:36:16: branch_true: ...to here
ddcutil-2.2.1/src/util/glib_string_util.c:39:24: acquire_memory: allocated here
ddcutil-2.2.1/src/util/glib_string_util.c:41:19: branch_false: following 'false' branch (when 'ndx >= ct')...
ddcutil-2.2.1/src/util/glib_string_util.c:46:19: branch_false: ...to here
ddcutil-2.2.1/src/util/glib_string_util.c:46:19: danger: 'pieces' leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#   44|               fprintf(stdout, "(%s) pieces[%d] = %s\n", __func__, ndx, pieces[ndx]);
#   45|         }
#   46|->       catenated = strjoin((const char**) pieces, ct, sepstr);
#   47|         if (debug)
#   48|            fprintf(stdout, "(%s) strlen(catenated)=%zd, catenated=%p, catenated=|%s|\n",

Error: GCC_ANALYZER_WARNING (CWE-775): [#def910]
ddcutil-2.2.1/src/util/libdrm_aux_util.c:174:28: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(devname, 2)'
ddcutil-2.2.1/src/util/libdrm_aux_util.c:163:15: acquire_resource: opened here
ddcutil-2.2.1/src/util/libdrm_aux_util.c:164:8: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/libdrm_aux_util.c:169:13: branch_false: ...to here
ddcutil-2.2.1/src/util/libdrm_aux_util.c:174:28: danger: 'open(devname, 2)' leaks here; was opened at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  172|          // gets information about the opened DRM device
#  173|          // returns 0 on success, negative error code otherwise
#  174|->        int get_device_rc = drmGetDevice(fd, &ddev);
#  175|          if (get_device_rc < 0) {
#  176|             DBGF(debug,  "drmGetDevice() returned %d = %s", get_device_rc, strerror(-get_device_rc));

Error: CPPCHECK_WARNING (CWE-401): [#def911]
ddcutil-2.2.1/src/util/libdrm_util.c:225: error[memleakOnRealloc]: Common realloc mistake: 'buf' nulled but not freed upon failure
#  223|               ", ");
#  224|      int bufsz = strlen(buf) + 100;
#  225|->    buf = realloc(buf, bufsz);  // in case we need to append
#  226|   
#  227|      uint32_t extended_type = flags & DRM_MODE_PROP_EXTENDED_TYPE;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def912]
ddcutil-2.2.1/src/util/libdrm_util.c:229:11: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
ddcutil-2.2.1/src/util/libdrm_util.c:715:6: enter_function: entry to 'summarize_drm_modeProperty'
ddcutil-2.2.1/src/util/libdrm_util.c:716:4: call_function: calling 'interpret_property_flags' from 'summarize_drm_modeProperty'
#  227|      uint32_t extended_type = flags & DRM_MODE_PROP_EXTENDED_TYPE;
#  228|      if (extended_type) {
#  229|->       if (strlen(buf) > 0)
#  230|            STRLCAT(buf, ", ", bufsz);
#  231|         char * extended_name = "other extended type";

Error: GCC_ANALYZER_WARNING (CWE-476): [#def913]
ddcutil-2.2.1/src/util/libdrm_util.c:239:11: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
ddcutil-2.2.1/src/util/libdrm_util.c:715:6: enter_function: entry to 'summarize_drm_modeProperty'
ddcutil-2.2.1/src/util/libdrm_util.c:716:4: call_function: calling 'interpret_property_flags' from 'summarize_drm_modeProperty'
#  237|      }
#  238|      if (flags & DRM_MODE_PROP_ATOMIC) {
#  239|->       if (strlen(buf) > 0)
#  240|            STRLCAT(buf, ", ", bufsz);
#  241|         STRLCAT(buf,  "DRM_MODE_PROP_ATOMIC", bufsz);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def914]
ddcutil-2.2.1/src/util/linux_util.c:54:7: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(filename, 0)'
ddcutil-2.2.1/src/util/linux_util.c:53:13: acquire_resource: opened here
ddcutil-2.2.1/src/util/linux_util.c:54:7: danger: 'open(filename, 0)' leaks here; was opened at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#   52|      bool result = false;
#   53|      int fd = open(filename, O_RDONLY);
#   54|->    if (fd > 0) {
#   55|         char buf;
#   56|         if (read(fd, &buf, 1) > 0)

Error: GCC_ANALYZER_WARNING: [#def915]
ddcutil-2.2.1/src/util/linux_util.c:56:11: warning[-Wanalyzer-fd-use-without-check]: 'read' on possibly invalid file descriptor 'open(filename, 0)'
ddcutil-2.2.1/src/util/linux_util.c:53:13: acquire_resource: opened here
ddcutil-2.2.1/src/util/linux_util.c:54:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/linux_util.c:56:11: branch_true: ...to here
ddcutil-2.2.1/src/util/linux_util.c:56:11: danger: 'open(filename, 0)' could be invalid: unchecked value from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#   54|      if (fd > 0) {
#   55|         char buf;
#   56|->       if (read(fd, &buf, 1) > 0)
#   57|            result = true;
#   58|         close(fd);

Error: GCC_ANALYZER_WARNING (CWE-775): [#def916]
ddcutil-2.2.1/src/util/linux_util.c:61:1: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'open(filename, 0)'
ddcutil-2.2.1/src/util/linux_util.c:53:13: acquire_resource: opened here
ddcutil-2.2.1/src/util/linux_util.c:54:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/linux_util.c:56:11: branch_true: ...to here
ddcutil-2.2.1/src/util/linux_util.c:61:1: danger: 'open(filename, 0)' leaks here; was opened at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   59|      }
#   60|      return result;
#   61|-> }
#   62|   
#   63|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def917]
ddcutil-2.2.1/src/util/linux_util.c:155:4: warning[-Wanalyzer-malloc-leak]: leak of 'module_name1'
ddcutil-2.2.1/src/util/linux_util.c:151:4: branch_false: following 'false' branch (when 'rc == 0')...
ddcutil-2.2.1/src/util/linux_util.c:153:26: branch_false: ...to here
ddcutil-2.2.1/src/util/linux_util.c:153:26: acquire_memory: allocated here
ddcutil-2.2.1/src/util/linux_util.c:155:4: danger: 'module_name1' leaks here; was allocated at [(3)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/2)
#  153|      char * module_name1 = strdup(module_name);
#  154|      char * module_name2 = strdup(module_name);
#  155|->    str_replace_char(module_name1, '-','_');
#  156|      str_replace_char(module_name2, '_','-');
#  157|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def918]
ddcutil-2.2.1/src/util/linux_util.c:155:4: warning[-Wanalyzer-malloc-leak]: leak of 'module_name2'
ddcutil-2.2.1/src/util/linux_util.c:151:4: branch_false: following 'false' branch (when 'rc == 0')...
ddcutil-2.2.1/src/util/linux_util.c:153:26: branch_false: ...to here
ddcutil-2.2.1/src/util/linux_util.c:154:26: acquire_memory: allocated here
ddcutil-2.2.1/src/util/linux_util.c:155:4: danger: 'module_name2' leaks here; was allocated at [(3)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/2)
#  153|      char * module_name1 = strdup(module_name);
#  154|      char * module_name2 = strdup(module_name);
#  155|->    str_replace_char(module_name1, '-','_');
#  156|      str_replace_char(module_name2, '_','-');
#  157|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def919]
ddcutil-2.2.1/src/util/linux_util.c:156:4: warning[-Wanalyzer-malloc-leak]: leak of 'module_name2'
ddcutil-2.2.1/src/util/linux_util.c:151:4: branch_false: following 'false' branch (when 'rc == 0')...
ddcutil-2.2.1/src/util/linux_util.c:153:26: branch_false: ...to here
ddcutil-2.2.1/src/util/linux_util.c:154:26: acquire_memory: allocated here
ddcutil-2.2.1/src/util/linux_util.c:156:4: danger: 'module_name2' leaks here; was allocated at [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2)
#  154|      char * module_name2 = strdup(module_name);
#  155|      str_replace_char(module_name1, '-','_');
#  156|->    str_replace_char(module_name2, '_','-');
#  157|   
#  158|      bool result = false;

Error: CPPCHECK_WARNING (CWE-476): [#def920]
ddcutil-2.2.1/src/util/multi_level_map.c:60: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: mlm
#   58|      // }
#   59|      Multi_Level_Map * mlm =  calloc(1, sizeof(Multi_Level_Map) + levels * sizeof(MLM_Level));
#   60|->    mlm->table_name = g_strdup(table_name);
#   61|      mlm->levels = levels;
#   62|      // MLM_Level* lvldesc = level_detail;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def921]
ddcutil-2.2.1/src/util/multi_level_map.c:60:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'mlm'
ddcutil-2.2.1/src/util/multi_level_map.c:54:19: enter_function: entry to 'mlm_create'
ddcutil-2.2.1/src/util/multi_level_map.c:59:29: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/multi_level_map.c:60:4: danger: 'mlm' could be NULL: unchecked value from [(2)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/1)
#   58|      // }
#   59|      Multi_Level_Map * mlm =  calloc(1, sizeof(Multi_Level_Map) + levels * sizeof(MLM_Level));
#   60|->    mlm->table_name = g_strdup(table_name);
#   61|      mlm->levels = levels;
#   62|      // MLM_Level* lvldesc = level_detail;

Error: CPPCHECK_WARNING (CWE-476): [#def922]
ddcutil-2.2.1/src/util/multi_level_map.c:61: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: mlm
#   59|      Multi_Level_Map * mlm =  calloc(1, sizeof(Multi_Level_Map) + levels * sizeof(MLM_Level));
#   60|      mlm->table_name = g_strdup(table_name);
#   61|->    mlm->levels = levels;
#   62|      // MLM_Level* lvldesc = level_detail;
#   63|      int initial_size = level_detail[0].initial_size;

Error: CPPCHECK_WARNING (CWE-476): [#def923]
ddcutil-2.2.1/src/util/multi_level_map.c:65: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: mlm
#   63|      int initial_size = level_detail[0].initial_size;
#   64|      // printf("(%s) initial_size=%d\n", __func__, initial_size);
#   65|->    mlm->root = g_ptr_array_sized_new(initial_size);
#   66|      memcpy((Byte*) &mlm->level_detail, level_detail, levels*sizeof(MLM_Level));
#   67|      // report_multi_level_table(mlm,0);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def924]
ddcutil-2.2.1/src/util/multi_level_map.c:65:16: warning[-Wanalyzer-malloc-leak]: leak of 'mlm'
ddcutil-2.2.1/src/util/multi_level_map.c:54:19: enter_function: entry to 'mlm_create'
ddcutil-2.2.1/src/util/multi_level_map.c:59:29: acquire_memory: allocated here
ddcutil-2.2.1/src/util/multi_level_map.c:65:16: danger: 'mlm' leaks here; was allocated at [(2)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/1)
#   63|      int initial_size = level_detail[0].initial_size;
#   64|      // printf("(%s) initial_size=%d\n", __func__, initial_size);
#   65|->    mlm->root = g_ptr_array_sized_new(initial_size);
#   66|      memcpy((Byte*) &mlm->level_detail, level_detail, levels*sizeof(MLM_Level));
#   67|      // report_multi_level_table(mlm,0);

Error: CPPCHECK_WARNING (CWE-476): [#def925]
ddcutil-2.2.1/src/util/multi_level_map.c:83: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_node
#   81|      // printf("(%s) parent=%p, key=0x%04x, value=|%s|\n", __func__, parent, key, value);
#   82|      MLM_Node * new_node = calloc(1,sizeof(MLM_Node));
#   83|->    new_node->code = key;
#   84|      new_node->name = value;
#   85|      new_node->children = NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def926]
ddcutil-2.2.1/src/util/multi_level_map.c:83:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'new_node'
ddcutil-2.2.1/src/util/multi_level_map.c:82:26: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/multi_level_map.c:83:4: danger: 'new_node' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#   81|      // printf("(%s) parent=%p, key=0x%04x, value=|%s|\n", __func__, parent, key, value);
#   82|      MLM_Node * new_node = calloc(1,sizeof(MLM_Node));
#   83|->    new_node->code = key;
#   84|      new_node->name = value;
#   85|      new_node->children = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def927]
ddcutil-2.2.1/src/util/multi_level_map.c:84: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_node
#   82|      MLM_Node * new_node = calloc(1,sizeof(MLM_Node));
#   83|      new_node->code = key;
#   84|->    new_node->name = value;
#   85|      new_node->children = NULL;
#   86|   

Error: CPPCHECK_WARNING (CWE-476): [#def928]
ddcutil-2.2.1/src/util/multi_level_map.c:85: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_node
#   83|      new_node->code = key;
#   84|      new_node->name = value;
#   85|->    new_node->children = NULL;
#   86|   
#   87|      if (!parent) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def929]
ddcutil-2.2.1/src/util/multi_level_map.c:89:7: warning[-Wanalyzer-malloc-leak]: leak of 'new_node'
ddcutil-2.2.1/src/util/multi_level_map.c:82:26: acquire_memory: allocated here
ddcutil-2.2.1/src/util/multi_level_map.c:87:7: branch_true: following 'true' branch (when 'parent' is NULL)...
ddcutil-2.2.1/src/util/multi_level_map.c:88:7: branch_true: ...to here
ddcutil-2.2.1/src/util/multi_level_map.c:89:7: danger: 'new_node' leaks here; was allocated at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#   87|      if (!parent) {
#   88|         new_node->level = 0;
#   89|->       g_ptr_array_add(map->root, new_node);
#   90|      }
#   91|      else {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def930]
ddcutil-2.2.1/src/util/multi_level_map.c:95:29: warning[-Wanalyzer-malloc-leak]: leak of 'new_node'
ddcutil-2.2.1/src/util/multi_level_map.c:82:26: acquire_memory: allocated here
ddcutil-2.2.1/src/util/multi_level_map.c:87:7: branch_false: following 'false' branch (when 'parent' is non-NULL)...
ddcutil-2.2.1/src/util/multi_level_map.c:92:25: branch_false: ...to here
ddcutil-2.2.1/src/util/multi_level_map.c:93:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/multi_level_map.c:94:47: branch_true: ...to here
ddcutil-2.2.1/src/util/multi_level_map.c:95:29: danger: 'new_node' leaks here; was allocated at [(1)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/0)
#   93|         if (!parent->children) {
#   94|            int initial_size = map->level_detail[parent->level].initial_size;
#   95|->          parent->children = g_ptr_array_sized_new(initial_size);
#   96|         }
#   97|         g_ptr_array_add(parent->children, new_node);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def931]
ddcutil-2.2.1/src/util/multi_level_map.c:97:7: warning[-Wanalyzer-malloc-leak]: leak of 'new_node'
ddcutil-2.2.1/src/util/multi_level_map.c:82:26: acquire_memory: allocated here
ddcutil-2.2.1/src/util/multi_level_map.c:87:7: branch_false: following 'false' branch (when 'parent' is non-NULL)...
ddcutil-2.2.1/src/util/multi_level_map.c:92:25: branch_false: ...to here
ddcutil-2.2.1/src/util/multi_level_map.c:93:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/multi_level_map.c:97:7: branch_false: ...to here
ddcutil-2.2.1/src/util/multi_level_map.c:97:7: danger: 'new_node' leaks here; was allocated at [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0)
#   95|            parent->children = g_ptr_array_sized_new(initial_size);
#   96|         }
#   97|->       g_ptr_array_add(parent->children, new_node);
#   98|      }
#   99|      map->level_detail[new_node->level].total_entries += 1;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def932]
ddcutil-2.2.1/src/util/regex_util.c:164:16: warning[-Wanalyzer-malloc-leak]: leak of 're'
ddcutil-2.2.1/src/util/regex_util.c:160:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/regex_util.c:161:12: branch_true: ...to here
ddcutil-2.2.1/src/util/regex_util.c:161:12: acquire_memory: allocated here
ddcutil-2.2.1/src/util/regex_util.c:164:16: danger: 're' leaks here; was allocated at [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  162|         if (debug)
#  163|            printf("(%s) Allocated regex %p, compiling...\n", __func__, (void*)re);
#  164|->       int rc = regcomp(re, pattern, REG_EXTENDED);
#  165|         if (rc != 0) {
#  166|            printf("(%s) regcomp() returned %d\n", __func__, rc);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def933]
ddcutil-2.2.1/src/util/regex_util.c:196:16: warning[-Wanalyzer-malloc-leak]: leak of 're'
ddcutil-2.2.1/src/util/regex_util.c:192:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/regex_util.c:193:12: branch_true: ...to here
ddcutil-2.2.1/src/util/regex_util.c:193:12: acquire_memory: allocated here
ddcutil-2.2.1/src/util/regex_util.c:196:16: danger: 're' leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#  194|         if (debug)
#  195|            printf("(%s) Allocated regex %p, compiling...\n", __func__, (void*)re);
#  196|->       int rc = regcomp(re, pattern, REG_EXTENDED);
#  197|         if (rc != 0) {
#  198|            printf("(%s) regcomp() returned %d\n", __func__, rc);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def934]
ddcutil-2.2.1/src/util/report_util.c:813:16: warning[-Wanalyzer-malloc-leak]: leak of 'buf'
ddcutil-2.2.1/src/util/report_util.c:811:17: acquire_memory: allocated here
ddcutil-2.2.1/src/util/report_util.c:813:16: danger: 'buf' leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  811|      char * buf = malloc(bufsz);
#  812|      char * hex_prefix = (hex_prefix_flag) ? "0x"  : "";
#  813|->    char * hs = hexstring(bytes, ct);
#  814|   
#  815|      snprintf(buf, bufsz-1, "%s%s", hex_prefix, hs);

Error: CPPCHECK_WARNING (CWE-476): [#def935]
ddcutil-2.2.1/src/util/report_util.c:815: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
#  813|      char * hs = hexstring(bytes, ct);
#  814|   
#  815|->    snprintf(buf, bufsz-1, "%s%s", hex_prefix, hs);
#  816|      rpt_str(name, info, buf, depth);
#  817|      free(buf);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def936]
ddcutil-2.2.1/src/util/report_util.c:901:23: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
ddcutil-2.2.1/src/util/report_util.c:894:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/report_util.c:895:4: branch_false: ...to here
ddcutil-2.2.1/src/util/report_util.c:898:16: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/report_util.c:899:61: branch_true: ...to here
ddcutil-2.2.1/src/util/report_util.c:901:23: danger: dereference of NULL 'find_flag_info_in_dictionary(*<unknown>,  pdict)'
#  899|         Flag_Info * pflag_info = find_flag_info_in_dictionary(pflag_name_set->flag_names[ndx], pdict);
#  900|         // printf("(%s) ndx=%d, pFlagInfp=%p   \n", __func__, ndx, pFlagInfo );
#  901|->       if (flags_val & pflag_info->flag_val) {
#  902|            if (first)
#  903|               first = false;

Error: CPPCHECK_WARNING (CWE-476): [#def937]
ddcutil-2.2.1/src/util/simple_ini_file.c:269: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ini_file
#  267|      if (result == 0) {
#  268|         Parsed_Ini_File * ini_file = calloc(1, sizeof(Parsed_Ini_File));
#  269|->       memcpy(ini_file->marker, PARSED_INI_FILE_MARKER, 4);
#  270|         ini_file->config_fn  = g_strdup(ini_file_name);
#  271|         ini_file->hash_table = ini_file_hash;

Error: CPPCHECK_WARNING (CWE-476): [#def938]
ddcutil-2.2.1/src/util/simple_ini_file.c:270: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ini_file
#  268|         Parsed_Ini_File * ini_file = calloc(1, sizeof(Parsed_Ini_File));
#  269|         memcpy(ini_file->marker, PARSED_INI_FILE_MARKER, 4);
#  270|->       ini_file->config_fn  = g_strdup(ini_file_name);
#  271|         ini_file->hash_table = ini_file_hash;
#  272|         *parsed_ini_loc = ini_file;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def939]
ddcutil-2.2.1/src/util/simple_ini_file.c:270:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'ini_file'
ddcutil-2.2.1/src/util/simple_ini_file.c:143:5: enter_function: entry to 'ini_file_load'
ddcutil-2.2.1/src/util/simple_ini_file.c:149:4: branch_false: following 'false' branch (when 'ini_file_name' is non-NULL)...
ddcutil-2.2.1/src/util/simple_ini_file.c:152:4: branch_false: ...to here
ddcutil-2.2.1/src/util/simple_ini_file.c:160:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/simple_ini_file.c:169:23: branch_false: ...to here
ddcutil-2.2.1/src/util/simple_ini_file.c:238:10: branch_false: following 'false' branch (when 'cur_segment' is NULL)...
ddcutil-2.2.1/src/util/simple_ini_file.c:240:10: branch_false: ...to here
ddcutil-2.2.1/src/util/simple_ini_file.c:240:10: branch_false: following 'false' branch (when 'error_ct <= 0')...
ddcutil-2.2.1/src/util/simple_ini_file.c:265:4: branch_false: ...to here
ddcutil-2.2.1/src/util/simple_ini_file.c:265:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/simple_ini_file.c:267:7: branch_false: ...to here
ddcutil-2.2.1/src/util/simple_ini_file.c:267:7: branch_true: following 'true' branch (when 'result == 0')...
ddcutil-2.2.1/src/util/simple_ini_file.c:268:36: branch_true: ...to here
ddcutil-2.2.1/src/util/simple_ini_file.c:268:36: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/simple_ini_file.c:270:30: call_function: inlined call to 'g_strdup_inline' from 'ini_file_load'
ddcutil-2.2.1/src/util/simple_ini_file.c:270:7: danger: 'ini_file' could be NULL: unchecked value from [(14)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/13)
#  268|         Parsed_Ini_File * ini_file = calloc(1, sizeof(Parsed_Ini_File));
#  269|         memcpy(ini_file->marker, PARSED_INI_FILE_MARKER, 4);
#  270|->       ini_file->config_fn  = g_strdup(ini_file_name);
#  271|         ini_file->hash_table = ini_file_hash;
#  272|         *parsed_ini_loc = ini_file;

Error: CPPCHECK_WARNING (CWE-476): [#def940]
ddcutil-2.2.1/src/util/simple_ini_file.c:271: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ini_file
#  269|         memcpy(ini_file->marker, PARSED_INI_FILE_MARKER, 4);
#  270|         ini_file->config_fn  = g_strdup(ini_file_name);
#  271|->       ini_file->hash_table = ini_file_hash;
#  272|         *parsed_ini_loc = ini_file;
#  273|      }

Error: CPPCHECK_WARNING (CWE-476): [#def941]
ddcutil-2.2.1/src/util/string_util.c:346: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  344|         ct = strlen(s) - startpos;
#  345|      char * result = calloc(ct+1, sizeof(char));
#  346|->    strncpy(result, s+startpos, ct);
#  347|      result[ct] = '\0';
#  348|      return result;

Error: CPPCHECK_WARNING (CWE-476): [#def942]
ddcutil-2.2.1/src/util/string_util.c:347: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  345|      char * result = calloc(ct+1, sizeof(char));
#  346|      strncpy(result, s+startpos, ct);
#  347|->    result[ct] = '\0';
#  348|      return result;
#  349|   }

Error: CPPCHECK_WARNING (CWE-476): [#def943]
ddcutil-2.2.1/src/util/string_util.c:396: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  394|      // printf("(%s) ct=%d, total_length=%d\n", __func__, ct, total_length);
#  395|      char * result = malloc(total_length);
#  396|->    result[0] = '\0';
#  397|      char * end = result;
#  398|      for (ndx=0; ndx<ct; ndx++) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def944]
ddcutil-2.2.1/src/util/string_util.c:396:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/util/string_util.c:383:8: branch_false: following 'false' branch (when 'sepstr' is NULL)...
ddcutil-2.2.1/src/util/string_util.c:385:17: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:395:20: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:396:4: danger: 'result' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2)
#  394|      // printf("(%s) ct=%d, total_length=%d\n", __func__, ct, total_length);
#  395|      char * result = malloc(total_length);
#  396|->    result[0] = '\0';
#  397|      char * end = result;
#  398|      for (ndx=0; ndx<ct; ndx++) {

Error: CPPCHECK_WARNING (CWE-682): [#def945]
ddcutil-2.2.1/src/util/string_util.c:407: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  405|      }
#  406|      // printf("(%s) result=%p, end=%p\n", __func__, result, end);
#  407|->    assert(end == result + total_length -1);
#  408|      return result;
#  409|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def946]
ddcutil-2.2.1/src/util/string_util.c:418:7: warning[-Wanalyzer-malloc-leak]: leak of 'buf'
ddcutil-2.2.1/src/util/string_util.c:415:17: acquire_memory: allocated here
ddcutil-2.2.1/src/util/string_util.c:417:21: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/string_util.c:418:78: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:418:7: branch_false: following 'false' branch (when 'next <= 0')...
 branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:418:7: danger: 'buf' leaks here; was allocated at [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  416|      int next = 0;
#  417|      for (int ctr =0; ctr < ct && next < bufsz; ctr++) {
#  418|->       g_snprintf(buf+next, bufsz-next,"%s%d", (next > 0) ? ", " : "", *(start+ctr) );
#  419|         next = strlen(buf);
#  420|      }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def947]
ddcutil-2.2.1/src/util/string_util.c:481:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'workstruct'
ddcutil-2.2.1/src/util/string_util.c:461:30: enter_function: entry to 'strsplit'
ddcutil-2.2.1/src/util/string_util.c:468:24: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:470:7: branch_true: following 'true' branch (when 'str_to_split' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:471:33: call_function: inlined call to 'g_strdup_inline' from 'strsplit'
ddcutil-2.2.1/src/util/string_util.c:477:14: branch_true: following 'true' branch (when 'token' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:480:14: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:480:13: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/string_util.c:481:24: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:481:37: call_function: inlined call to 'g_strdup_inline' from 'strsplit'
ddcutil-2.2.1/src/util/string_util.c:481:13: danger: 'workstruct + (long unsigned int)piecect * 8' could be NULL: unchecked value from [(2)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/1)
#  479|               printf("(%s) token: |%s|\n", __func__, token);
#  480|            if (strlen(token) > 0)
#  481|->             workstruct[piecect++] = g_strdup(token);
#  482|            token = strsep(&rest, delims);
#  483|         }

Error: CPPCHECK_WARNING (CWE-476): [#def948]
ddcutil-2.2.1/src/util/string_util.c:491: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  489|      char ** result = calloc(sizeof(char *), piecect+1);
#  490|      // n. workstruct[piecect] == NULL because we used calloc()
#  491|->    memcpy(result, workstruct, (piecect+1)*sizeof(char*) );
#  492|   
#  493|      if (debug) {

Error: CPPCHECK_WARNING (CWE-476): [#def949]
ddcutil-2.2.1/src/util/string_util.c:491: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: workstruct
#  489|      char ** result = calloc(sizeof(char *), piecect+1);
#  490|      // n. workstruct[piecect] == NULL because we used calloc()
#  491|->    memcpy(result, workstruct, (piecect+1)*sizeof(char*) );
#  492|   
#  493|      if (debug) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def950]
ddcutil-2.2.1/src/util/string_util.c:538:47: warning[-Wanalyzer-null-argument]: use of NULL 'str_to_split' where non-null expected
ddcutil-2.2.1/src/util/string_util.c:525:1: enter_function: entry to 'strsplit_maxlength'
ddcutil-2.2.1/src/util/string_util.c:538:47: danger: argument 1 ('str_to_split') NULL where non-null expected
#argument 1 of '__builtin_strlen' must be non-null
#  536|      char * str_to_split2 = g_strdup(str_to_split);   // work around constness
#  537|      char * start = str_to_split2;
#  538|->    char * str_to_split2_end = str_to_split2 + strlen(str_to_split);
#  539|      if (debug)
#  540|         printf("(%s)x start=%p, str_to_split2_end=%p\n", __func__, (void*)start, (void*)str_to_split2_end);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def951]
ddcutil-2.2.1/src/util/string_util.c:565:7: warning[-Wanalyzer-malloc-leak]: leak of 'piece'
ddcutil-2.2.1/src/util/string_util.c:541:11: branch_true: following 'true' branch (when 'start < str_to_split2_end')...
ddcutil-2.2.1/src/util/string_util.c:544:20: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:564:22: acquire_memory: allocated here
ddcutil-2.2.1/src/util/string_util.c:565:7: danger: 'piece' leaks here; was allocated at [(3)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/2)
#  563|         }
#  564|         char * piece = strndup(start, end-start);
#  565|->       g_ptr_array_add(pieces, piece);
#  566|         start = start + strlen(piece);
#  567|      }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def952]
ddcutil-2.2.1/src/util/string_util.c:572:4: warning[-Wanalyzer-malloc-leak]: leak of 'g_ptr_array_to_ntsa(g_ptr_array_sized_new(20), 1)'
ddcutil-2.2.1/src/util/string_util.c:525:1: enter_function: entry to 'strsplit_maxlength'
ddcutil-2.2.1/src/util/string_util.c:541:11: branch_false: following 'false' branch (when 'start >= str_to_split2_end')...
ddcutil-2.2.1/src/util/string_util.c:571:42: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:571:42: call_function: calling 'g_ptr_array_to_ntsa' from 'strsplit_maxlength'
ddcutil-2.2.1/src/util/string_util.c:571:42: return_function: returning to 'strsplit_maxlength' from 'g_ptr_array_to_ntsa'
ddcutil-2.2.1/src/util/string_util.c:572:4: danger: 'g_ptr_array_to_ntsa(g_ptr_array_sized_new(20), 1)' leaks here; was allocated at [(8)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/7)
#  570|      // g_ptr_array(pieces, false) is called, valgrind complains about memory leak
#  571|      Null_Terminated_String_Array result = g_ptr_array_to_ntsa(pieces, /*duplicate=*/ true);
#  572|->    g_ptr_array_set_free_func(pieces, g_free);
#  573|      g_ptr_array_free(pieces, true);
#  574|      free(str_to_split2);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def953]
ddcutil-2.2.1/src/util/string_util.c:573:4: warning[-Wanalyzer-malloc-leak]: leak of 'g_ptr_array_to_ntsa(g_ptr_array_sized_new(20), 1)'
ddcutil-2.2.1/src/util/string_util.c:525:1: enter_function: entry to 'strsplit_maxlength'
ddcutil-2.2.1/src/util/string_util.c:541:11: branch_false: following 'false' branch (when 'start >= str_to_split2_end')...
ddcutil-2.2.1/src/util/string_util.c:571:42: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:571:42: call_function: calling 'g_ptr_array_to_ntsa' from 'strsplit_maxlength'
ddcutil-2.2.1/src/util/string_util.c:571:42: return_function: returning to 'strsplit_maxlength' from 'g_ptr_array_to_ntsa'
ddcutil-2.2.1/src/util/string_util.c:573:4: danger: 'g_ptr_array_to_ntsa(g_ptr_array_sized_new(20), 1)' leaks here; was allocated at [(8)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/7)
#  571|      Null_Terminated_String_Array result = g_ptr_array_to_ntsa(pieces, /*duplicate=*/ true);
#  572|      g_ptr_array_set_free_func(pieces, g_free);
#  573|->    g_ptr_array_free(pieces, true);
#  574|      free(str_to_split2);
#  575|      if (debug)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def954]
ddcutil-2.2.1/src/util/string_util.c:654:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'to'
ddcutil-2.2.1/src/util/string_util.c:641:30: enter_function: entry to 'ntsa_join'
ddcutil-2.2.1/src/util/string_util.c:646:4: branch_false: following 'false' branch (when 'a1' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:647:4: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:647:4: branch_false: following 'false' branch (when 'a2' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:648:13: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:648:13: call_function: calling 'ntsa_length' from 'ntsa_join'
ddcutil-2.2.1/src/util/string_util.c:648:13: return_function: returning to 'ntsa_join' from 'ntsa_length'
ddcutil-2.2.1/src/util/string_util.c:648:31: call_function: calling 'ntsa_length' from 'ntsa_join'
ddcutil-2.2.1/src/util/string_util.c:648:31: return_function: returning to 'ntsa_join' from 'ntsa_length'
ddcutil-2.2.1/src/util/string_util.c:649:42: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:652:11: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/string_util.c:653:10: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:653:10: branch_true: following 'true' branch (when 'dup != 0')...
ddcutil-2.2.1/src/util/string_util.c:654:16: call_function: inlined call to 'g_strdup_inline' from 'ntsa_join'
ddcutil-2.2.1/src/util/string_util.c:654:10: danger: 'to' could be NULL: unchecked value from [(16)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/15)
#  652|      while (*from) {
#  653|         if (dup)
#  654|->          *to = g_strdup(*from);
#  655|         else
#  656|            *to = *from;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def955]
ddcutil-2.2.1/src/util/string_util.c:656:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'to'
ddcutil-2.2.1/src/util/string_util.c:641:30: enter_function: entry to 'ntsa_join'
ddcutil-2.2.1/src/util/string_util.c:646:4: branch_false: following 'false' branch (when 'a1' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:647:4: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:647:4: branch_false: following 'false' branch (when 'a2' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:648:13: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:648:13: call_function: calling 'ntsa_length' from 'ntsa_join'
ddcutil-2.2.1/src/util/string_util.c:648:13: return_function: returning to 'ntsa_join' from 'ntsa_length'
ddcutil-2.2.1/src/util/string_util.c:648:31: call_function: calling 'ntsa_length' from 'ntsa_join'
ddcutil-2.2.1/src/util/string_util.c:648:31: return_function: returning to 'ntsa_join' from 'ntsa_length'
ddcutil-2.2.1/src/util/string_util.c:649:42: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:652:11: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/string_util.c:653:10: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:653:10: branch_false: following 'false' branch (when 'dup == 0')...
ddcutil-2.2.1/src/util/string_util.c:656:10: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:656:10: danger: 'to' could be NULL: unchecked value from [(16)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/15)
#  654|            *to = g_strdup(*from);
#  655|         else
#  656|->          *to = *from;
#  657|         to++;
#  658|         from++;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def956]
ddcutil-2.2.1/src/util/string_util.c:663:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'to'
ddcutil-2.2.1/src/util/string_util.c:641:30: enter_function: entry to 'ntsa_join'
ddcutil-2.2.1/src/util/string_util.c:646:4: branch_false: following 'false' branch (when 'a1' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:647:4: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:647:4: branch_false: following 'false' branch (when 'a2' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:648:13: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:648:13: call_function: calling 'ntsa_length' from 'ntsa_join'
ddcutil-2.2.1/src/util/string_util.c:648:13: return_function: returning to 'ntsa_join' from 'ntsa_length'
ddcutil-2.2.1/src/util/string_util.c:648:31: call_function: calling 'ntsa_length' from 'ntsa_join'
ddcutil-2.2.1/src/util/string_util.c:648:31: return_function: returning to 'ntsa_join' from 'ntsa_length'
ddcutil-2.2.1/src/util/string_util.c:649:42: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:652:11: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:661:11: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/string_util.c:662:10: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:662:10: branch_true: following 'true' branch (when 'dup != 0')...
ddcutil-2.2.1/src/util/string_util.c:663:16: call_function: inlined call to 'g_strdup_inline' from 'ntsa_join'
ddcutil-2.2.1/src/util/string_util.c:663:10: danger: 'to' could be NULL: unchecked value from [(16)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/15)
#  661|      while (*from) {
#  662|         if (dup)
#  663|->          *to = g_strdup(*from);
#  664|         else
#  665|            *to = *from;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def957]
ddcutil-2.2.1/src/util/string_util.c:665:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'to'
ddcutil-2.2.1/src/util/string_util.c:641:30: enter_function: entry to 'ntsa_join'
ddcutil-2.2.1/src/util/string_util.c:646:4: branch_false: following 'false' branch (when 'a1' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:647:4: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:647:4: branch_false: following 'false' branch (when 'a2' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:648:13: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:648:13: call_function: calling 'ntsa_length' from 'ntsa_join'
ddcutil-2.2.1/src/util/string_util.c:648:13: return_function: returning to 'ntsa_join' from 'ntsa_length'
ddcutil-2.2.1/src/util/string_util.c:648:31: call_function: calling 'ntsa_length' from 'ntsa_join'
ddcutil-2.2.1/src/util/string_util.c:648:31: return_function: returning to 'ntsa_join' from 'ntsa_length'
ddcutil-2.2.1/src/util/string_util.c:649:42: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:652:11: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:661:11: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/string_util.c:662:10: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:662:10: branch_false: following 'false' branch (when 'dup == 0')...
ddcutil-2.2.1/src/util/string_util.c:665:10: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:665:10: danger: 'to' could be NULL: unchecked value from [(16)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/15)
#  663|            *to = g_strdup(*from);
#  664|         else
#  665|->          *to = *from;
#  666|         to++;
#  667|         from++;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def958]
ddcutil-2.2.1/src/util/string_util.c:692:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'to'
ddcutil-2.2.1/src/util/string_util.c:683:30: enter_function: entry to 'ntsa_copy'
ddcutil-2.2.1/src/util/string_util.c:685:4: branch_false: following 'false' branch (when 'a1' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:686:13: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:686:13: call_function: calling 'ntsa_length' from 'ntsa_copy'
ddcutil-2.2.1/src/util/string_util.c:686:13: return_function: returning to 'ntsa_copy' from 'ntsa_length'
ddcutil-2.2.1/src/util/string_util.c:687:42: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:690:11: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/string_util.c:691:10: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:691:10: branch_true: following 'true' branch (when 'dup != 0')...
ddcutil-2.2.1/src/util/string_util.c:692:16: call_function: inlined call to 'g_strdup_inline' from 'ntsa_copy'
ddcutil-2.2.1/src/util/string_util.c:692:10: danger: 'to' could be NULL: unchecked value from [(9)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/8)
#  690|      while (*from) {
#  691|         if (dup)
#  692|->          *to = g_strdup(*from);
#  693|         else
#  694|            *to = *from;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def959]
ddcutil-2.2.1/src/util/string_util.c:694:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'to'
ddcutil-2.2.1/src/util/string_util.c:683:30: enter_function: entry to 'ntsa_copy'
ddcutil-2.2.1/src/util/string_util.c:685:4: branch_false: following 'false' branch (when 'a1' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:686:13: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:686:13: call_function: calling 'ntsa_length' from 'ntsa_copy'
ddcutil-2.2.1/src/util/string_util.c:686:13: return_function: returning to 'ntsa_copy' from 'ntsa_length'
ddcutil-2.2.1/src/util/string_util.c:687:42: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:690:11: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/string_util.c:691:10: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:691:10: branch_false: following 'false' branch (when 'dup == 0')...
ddcutil-2.2.1/src/util/string_util.c:694:10: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:694:10: danger: 'to' could be NULL: unchecked value from [(9)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/8)
#  692|            *to = g_strdup(*from);
#  693|         else
#  694|->          *to = *from;
#  695|         to++;
#  696|         from++;

Error: CPPCHECK_WARNING (CWE-682): [#def960]
ddcutil-2.2.1/src/util/string_util.c:711: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  709|      Null_Terminated_String_Array new_array = calloc((new_ct+1), sizeof(char *));
#  710|      char ** to = new_array;
#  711|->    *to++ = (dup) ? g_strdup(value) : value;
#  712|      char ** from = old_array;
#  713|      while (*from) {

Error: CPPCHECK_WARNING (CWE-476): [#def961]
ddcutil-2.2.1/src/util/string_util.c:711: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: to++
#  709|      Null_Terminated_String_Array new_array = calloc((new_ct+1), sizeof(char *));
#  710|      char ** to = new_array;
#  711|->    *to++ = (dup) ? g_strdup(value) : value;
#  712|      char ** from = old_array;
#  713|      while (*from) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def962]
ddcutil-2.2.1/src/util/string_util.c:711:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'new_array'
ddcutil-2.2.1/src/util/string_util.c:702:31: enter_function: entry to 'ntsa_prepend'
ddcutil-2.2.1/src/util/string_util.c:707:17: call_function: calling 'ntsa_length' from 'ntsa_prepend'
ddcutil-2.2.1/src/util/string_util.c:707:17: return_function: returning to 'ntsa_prepend' from 'ntsa_length'
ddcutil-2.2.1/src/util/string_util.c:709:45: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:711:4: danger: 'new_array' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/15/codeFlows/0/threadFlows/0/locations/6)
#  709|      Null_Terminated_String_Array new_array = calloc((new_ct+1), sizeof(char *));
#  710|      char ** to = new_array;
#  711|->    *to++ = (dup) ? g_strdup(value) : value;
#  712|      char ** from = old_array;
#  713|      while (*from) {

Error: CPPCHECK_WARNING (CWE-476): [#def963]
ddcutil-2.2.1/src/util/string_util.c:726: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_array
#  724|   Null_Terminated_String_Array ntsa_create_empty_array() {
#  725|      Null_Terminated_String_Array new_array = calloc(1, sizeof(char *));
#  726|->    *new_array = NULL;
#  727|      return new_array;
#  728|   }

Error: CPPCHECK_WARNING (CWE-476): [#def964]
ddcutil-2.2.1/src/util/string_util.c:826: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ntsa
#  824|      for (guint ndx=0; ndx < gparray->len; ndx++) {
#  825|         if (duplicate)
#  826|->          ntsa[ndx] = g_strdup(g_ptr_array_index(gparray,ndx));
#  827|         else
#  828|            ntsa[ndx] = g_ptr_array_index(gparray,ndx);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def965]
ddcutil-2.2.1/src/util/string_util.c:826:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'ntsa'
ddcutil-2.2.1/src/util/string_util.c:818:1: enter_function: entry to 'g_ptr_array_to_ntsa'
ddcutil-2.2.1/src/util/string_util.c:822:4: branch_false: following 'false' branch (when 'gparray' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:823:47: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:823:40: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:824:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/string_util.c:825:10: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:825:10: branch_true: following 'true' branch (when 'duplicate != 0')...
ddcutil-2.2.1/src/util/string_util.c:826:22: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:826:10: danger: 'ntsa + (long unsigned int)ndx * 8' could be NULL: unchecked value from [(4)](sarif:/runs/0/results/16/codeFlows/0/threadFlows/0/locations/3)
#  824|      for (guint ndx=0; ndx < gparray->len; ndx++) {
#  825|         if (duplicate)
#  826|->          ntsa[ndx] = g_strdup(g_ptr_array_index(gparray,ndx));
#  827|         else
#  828|            ntsa[ndx] = g_ptr_array_index(gparray,ndx);

Error: CPPCHECK_WARNING (CWE-476): [#def966]
ddcutil-2.2.1/src/util/string_util.c:828: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: ntsa
#  826|            ntsa[ndx] = g_strdup(g_ptr_array_index(gparray,ndx));
#  827|         else
#  828|->          ntsa[ndx] = g_ptr_array_index(gparray,ndx);
#  829|      }
#  830|      return ntsa;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def967]
ddcutil-2.2.1/src/util/string_util.c:828:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'ntsa'
ddcutil-2.2.1/src/util/string_util.c:822:4: branch_false: following 'false' branch (when 'gparray' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:823:47: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:823:40: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:824:22: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/string_util.c:825:10: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:825:10: branch_false: following 'false' branch (when 'duplicate == 0')...
ddcutil-2.2.1/src/util/string_util.c:828:22: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:828:10: danger: 'ntsa + (long unsigned int)ndx * 8' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/2)
#  826|            ntsa[ndx] = g_strdup(g_ptr_array_index(gparray,ndx));
#  827|         else
#  828|->          ntsa[ndx] = g_ptr_array_index(gparray,ndx);
#  829|      }
#  830|      return ntsa;

Error: CPPCHECK_WARNING (CWE-476): [#def968]
ddcutil-2.2.1/src/util/string_util.c:912: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  910|       assert(s2);
#  911|       char * result = malloc(strlen(s1) + strlen(s2) + 1);
#  912|->     strcpy(result, s1);
#  913|       strcpy(result+strlen(s1), s2);
#  914|       return result;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def969]
ddcutil-2.2.1/src/util/string_util.c:912:5: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'result' where non-null expected
ddcutil-2.2.1/src/util/string_util.c:909:5: branch_false: following 'false' branch (when 's1' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:910:5: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:910:5: branch_false: following 'false' branch (when 's2' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:911:28: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:911:21: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:912:5: danger: argument 1 ('result') from [(5)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/4) could be NULL where non-null expected
#argument 1 of '__builtin_strcpy' must be non-null
#  910|       assert(s2);
#  911|       char * result = malloc(strlen(s1) + strlen(s2) + 1);
#  912|->     strcpy(result, s1);
#  913|       strcpy(result+strlen(s1), s2);
#  914|       return result;

Error: CPPCHECK_WARNING (CWE-682): [#def970]
ddcutil-2.2.1/src/util/string_util.c:913: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  911|       char * result = malloc(strlen(s1) + strlen(s2) + 1);
#  912|       strcpy(result, s1);
#  913|->     strcpy(result+strlen(s1), s2);
#  914|       return result;
#  915|   }

Error: CPPCHECK_WARNING (CWE-476): [#def971]
ddcutil-2.2.1/src/util/string_util.c:931: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: strbuf
#  929|      if (start) {
#  930|         strbuf = malloc(len+1);
#  931|->       memcpy(strbuf, start, len);
#  932|         *(strbuf + len) = '\0';
#  933|      }

Error: CPPCHECK_WARNING (CWE-682): [#def972]
ddcutil-2.2.1/src/util/string_util.c:932: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  930|         strbuf = malloc(len+1);
#  931|         memcpy(strbuf, start, len);
#  932|->       *(strbuf + len) = '\0';
#  933|      }
#  934|      return strbuf;

Error: CPPCHECK_WARNING (CWE-476): [#def973]
ddcutil-2.2.1/src/util/string_util.c:1037: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: work
# 1035|            else {
# 1036|               work = strdup(sval);
# 1037|->             has_digits = strlen(work) > 0;
# 1038|            }
# 1039|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def974]
ddcutil-2.2.1/src/util/string_util.c:1037:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'work'
ddcutil-2.2.1/src/util/string_util.c:1027:7: branch_true: following 'true' branch (when 'sval' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:1028:12: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:1028:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/string_util.c:1031:14: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:1031:13: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/string_util.c:1036:20: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1036:20: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:1037:26: danger: 'work' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/6)
# 1035|            else {
# 1036|               work = strdup(sval);
# 1037|->             has_digits = strlen(work) > 0;
# 1038|            }
# 1039|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def975]
ddcutil-2.2.1/src/util/string_util.c:1193:13: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
ddcutil-2.2.1/src/util/string_util.c:1186:6: enter_function: entry to 'any_one_byte_hex_string_to_byte_in_buf'
ddcutil-2.2.1/src/util/string_util.c:1189:17: call_function: calling 'strdup_uc' from 'any_one_byte_hex_string_to_byte_in_buf'
ddcutil-2.2.1/src/util/string_util.c:1189:17: return_function: returning to 'any_one_byte_hex_string_to_byte_in_buf' from 'strdup_uc'
ddcutil-2.2.1/src/util/string_util.c:1191:8: call_function: calling 'str_starts_with' from 'any_one_byte_hex_string_to_byte_in_buf'
ddcutil-2.2.1/src/util/string_util.c:1191:8: return_function: returning to 'any_one_byte_hex_string_to_byte_in_buf' from 'str_starts_with'
ddcutil-2.2.1/src/util/string_util.c:1191:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/string_util.c:1193:13: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1193:13: danger: dereference of NULL 'strdup_uc(s)'
# 1191|      if (str_starts_with(suc, "0X"))
# 1192|            suc = suc + 2;
# 1193|->    else if (*suc == 'X')
# 1194|            suc = suc + 1;
# 1195|      else if (str_ends_with(suc, "H"))

Error: GCC_ANALYZER_WARNING (CWE-476): [#def976]
ddcutil-2.2.1/src/util/string_util.c:1254:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'b'
ddcutil-2.2.1/src/util/string_util.c:1239:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/string_util.c:1241:9: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1243:16: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:1248:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/string_util.c:1253:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/string_util.c:1254:15: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:1254:10: danger: 'b' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/21/codeFlows/0/threadFlows/0/locations/2)
# 1252|         char * pos1 = strchr(xlate, ch1);
# 1253|         if (pos0 && pos1) {
# 1254|->          *b = (pos0-xlate) * 16 + (pos1-xlate);
# 1255|         }
# 1256|         else {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def977]
ddcutil-2.2.1/src/util/string_util.c:1409:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'buffer'
ddcutil-2.2.1/src/util/string_util.c:1393:7: branch_true: following 'true' branch (when 'len == 0')...
 branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:1398:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/string_util.c:1399:7: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1399:7: branch_true: following 'true' branch (when 'bufsz == 0')...
ddcutil-2.2.1/src/util/string_util.c:1400:16: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:1400:16: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:1408:7: branch_true: following 'true' branch (when 'len == 0')...
ddcutil-2.2.1/src/util/string_util.c:1409:7: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:1409:7: danger: 'buffer' could be NULL: unchecked value from [(7)](sarif:/runs/0/results/22/codeFlows/0/threadFlows/0/locations/6)
# 1407|      int i;
# 1408|      if (len == 0)
# 1409|->       *buffer = '\0';
# 1410|      for (i=0; i < len; i++) {
# 1411|         // printf("(%s) i=%d, buffer+i*incr1=%p\n", __func__, i, buffer+i*incr1);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def978]
ddcutil-2.2.1/src/util/string_util.c:1412:7: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'buffer' where non-null expected
ddcutil-2.2.1/src/util/string_util.c:1384:7: branch_false: following 'false' branch (when 'sepstr' is NULL)...
ddcutil-2.2.1/src/util/string_util.c:1387:29: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1393:7: branch_false: following 'false' branch (when 'len != 0')...
ddcutil-2.2.1/src/util/string_util.c:1396:7: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1398:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/string_util.c:1399:7: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1399:7: branch_true: following 'true' branch (when 'bufsz == 0')...
ddcutil-2.2.1/src/util/string_util.c:1400:16: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:1400:16: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:1408:7: branch_false: following 'false' branch (when 'len != 0')...
 branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1410:14: branch_true: following 'true' branch (when 'i < len')...
ddcutil-2.2.1/src/util/string_util.c:1412:45: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:1412:7: danger: argument 1 ('buffer + (sizetype)(i * incr1)') from [(9)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/8) could be NULL where non-null expected
#argument 1 of '__builtin_sprintf' must be non-null
# 1410|      for (i=0; i < len; i++) {
# 1411|         // printf("(%s) i=%d, buffer+i*incr1=%p\n", __func__, i, buffer+i*incr1);
# 1412|->       sprintf(buffer+i*incr1, pattern, bytes[i]);
# 1413|         if (i < (len-1) && sepstr)
# 1414|            strcat(buffer, sepstr);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def979]
ddcutil-2.2.1/src/util/string_util.c:1418:4: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'buffer' where non-null expected
ddcutil-2.2.1/src/util/string_util.c:1384:7: branch_false: following 'false' branch (when 'sepstr' is NULL)...
ddcutil-2.2.1/src/util/string_util.c:1387:29: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1393:7: branch_false: following 'false' branch (when 'len != 0')...
ddcutil-2.2.1/src/util/string_util.c:1396:7: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1398:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/string_util.c:1399:7: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1399:7: branch_true: following 'true' branch (when 'bufsz == 0')...
ddcutil-2.2.1/src/util/string_util.c:1400:16: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:1400:16: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:1408:7: branch_false: following 'false' branch (when 'len != 0')...
 branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1410:14: branch_false: following 'false' branch (when 'i >= len')...
ddcutil-2.2.1/src/util/string_util.c:1418:4: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1418:4: danger: argument 1 ('buffer') from [(9)](sarif:/runs/0/results/25/codeFlows/0/threadFlows/0/locations/8) could be NULL where non-null expected
#argument 1 of '__builtin_strlen' must be non-null
# 1416|      // printf("(%s) strlen(buffer) = %ld, required_size=%d   \n", __func__, strlen(buffer), required_size );
# 1417|      // printf("(%s)  buffer=|%s|\n", __func__, buffer );
# 1418|->    assert(strlen(buffer) == required_size-1);
# 1419|   
# 1420|      return buffer;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def980]
ddcutil-2.2.1/src/util/string_util.c:1418:4: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value '*buffer'
ddcutil-2.2.1/src/util/string_util.c:1384:7: branch_false: following 'false' branch (when 'sepstr' is NULL)...
ddcutil-2.2.1/src/util/string_util.c:1387:29: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1393:7: branch_false: following 'false' branch (when 'len != 0')...
ddcutil-2.2.1/src/util/string_util.c:1396:7: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1398:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/string_util.c:1399:7: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1399:7: branch_true: following 'true' branch (when 'bufsz == 0')...
ddcutil-2.2.1/src/util/string_util.c:1400:16: branch_true: ...to here
ddcutil-2.2.1/src/util/string_util.c:1408:7: branch_false: following 'false' branch (when 'len != 0')...
 branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1410:14: branch_false: following 'false' branch (when 'i >= len')...
ddcutil-2.2.1/src/util/string_util.c:1418:4: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1418:4: danger: use of uninitialized value '*buffer' here
# 1416|      // printf("(%s) strlen(buffer) = %ld, required_size=%d   \n", __func__, strlen(buffer), required_size );
# 1417|      // printf("(%s)  buffer=|%s|\n", __func__, buffer );
# 1418|->    assert(strlen(buffer) == required_size-1);
# 1419|   
# 1420|      return buffer;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def981]
ddcutil-2.2.1/src/util/string_util.c:1850:7: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'buf' where non-null expected
ddcutil-2.2.1/src/util/string_util.c:1830:8: enter_function: entry to 'canonicalize_possible_hex_value'
ddcutil-2.2.1/src/util/string_util.c:1831:4: branch_false: following 'false' branch (when 'string_value' is non-NULL)...
ddcutil-2.2.1/src/util/string_util.c:1833:16: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1834:17: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/string_util.c:1835:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/string_util.c:1839:30: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1839:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/string_util.c:1846:13: call_function: calling 'str_starts_with' from 'canonicalize_possible_hex_value'
ddcutil-2.2.1/src/util/string_util.c:1846:13: return_function: returning to 'canonicalize_possible_hex_value' from 'str_starts_with'
ddcutil-2.2.1/src/util/string_util.c:1846:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/string_util.c:1850:7: branch_false: ...to here
ddcutil-2.2.1/src/util/string_util.c:1850:7: danger: argument 1 ('buf') from [(4)](sarif:/runs/0/results/27/codeFlows/0/threadFlows/0/locations/3) could be NULL where non-null expected
#argument 1 of '__builtin_strcpy' must be non-null
# 1848|      }
# 1849|      else
# 1850|->       strcpy(buf, string_value);
# 1851|      // DBGMSG("string_value=|%s|, returning |%s|", string_value, buf);
# 1852|      return buf;

Error: CPPCHECK_WARNING (CWE-476): [#def982]
ddcutil-2.2.1/src/util/subprocess_util.c:46: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cmdbuf
#   44|      int bufsz = strlen(shell_cmd) + 50;
#   45|      char * cmdbuf = calloc(1, bufsz);
#   46|->    snprintf(cmdbuf, bufsz, "(%s) 2>&1", shell_cmd);
#   47|      // printf("(%s) cmdbuf=|%s|\n", __func__, cmdbuf);
#   48|      fp = popen(cmdbuf, "r");

Error: CPPCHECK_WARNING (CWE-476): [#def983]
ddcutil-2.2.1/src/util/subprocess_util.c:140: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cmdbuf
#  138|      int bufsz = strlen(shell_cmd) + 50;
#  139|      char * cmdbuf = calloc(1, bufsz);
#  140|->    snprintf(cmdbuf, bufsz, "(%s) 2>&1", shell_cmd);
#  141|      // printf("(%s) cmdbuf=|%s|\n", __func__, cmdbuf);
#  142|      fp = popen(cmdbuf, "r");

Error: CPPCHECK_WARNING (CWE-476): [#def984]
ddcutil-2.2.1/src/util/subprocess_util.c:294: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: full_cmd
#  292|      assert(cmd);
#  293|      char * full_cmd = calloc(1, strlen(cmd) + 20);
#  294|->    strcpy(full_cmd, cmd);
#  295|      strcat(full_cmd, ">/dev/null 2>&1");
#  296|      // printf("(%s) cmd: |%s|, full_cmd: |%s|\n", __func__, cmd, full_cmd);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def985]
ddcutil-2.2.1/src/util/subprocess_util.c:294:4: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'full_cmd' where non-null expected
ddcutil-2.2.1/src/util/subprocess_util.c:292:4: branch_false: following 'false' branch (when 'cmd' is non-NULL)...
ddcutil-2.2.1/src/util/subprocess_util.c:293:32: branch_false: ...to here
ddcutil-2.2.1/src/util/subprocess_util.c:293:22: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/subprocess_util.c:294:4: danger: argument 1 ('full_cmd') from [(3)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/2) could be NULL where non-null expected
#argument 1 of '__builtin_strcpy' must be non-null
#  292|      assert(cmd);
#  293|      char * full_cmd = calloc(1, strlen(cmd) + 20);
#  294|->    strcpy(full_cmd, cmd);
#  295|      strcat(full_cmd, ">/dev/null 2>&1");
#  296|      // printf("(%s) cmd: |%s|, full_cmd: |%s|\n", __func__, cmd, full_cmd);

Error: CPPCHECK_WARNING (CWE-476): [#def986]
ddcutil-2.2.1/src/util/subprocess_util.c:295: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: full_cmd
#  293|      char * full_cmd = calloc(1, strlen(cmd) + 20);
#  294|      strcpy(full_cmd, cmd);
#  295|->    strcat(full_cmd, ">/dev/null 2>&1");
#  296|      // printf("(%s) cmd: |%s|, full_cmd: |%s|\n", __func__, cmd, full_cmd);
#  297|      int rc = system(full_cmd);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def987]
ddcutil-2.2.1/src/util/subprocess_util.c:297:13: warning[-Wanalyzer-malloc-leak]: leak of 'full_cmd'
ddcutil-2.2.1/src/util/subprocess_util.c:292:4: branch_false: following 'false' branch (when 'cmd' is non-NULL)...
ddcutil-2.2.1/src/util/subprocess_util.c:293:32: branch_false: ...to here
ddcutil-2.2.1/src/util/subprocess_util.c:293:22: acquire_memory: allocated here
ddcutil-2.2.1/src/util/subprocess_util.c:297:13: danger: 'full_cmd' leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#  295|      strcat(full_cmd, ">/dev/null 2>&1");
#  296|      // printf("(%s) cmd: |%s|, full_cmd: |%s|\n", __func__, cmd, full_cmd);
#  297|->    int rc = system(full_cmd);
#  298|      // printf("(%s) system(%s) returned: %d, %d, %d\n", __func__, full_cmd, rc, WIFEXITED(rc), WEXITSTATUS(rc));
#  299|      free(full_cmd);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def988]
ddcutil-2.2.1/src/util/sysfs_util.c:273:25: warning[-Wanalyzer-malloc-leak]: leak of 'opendir(dirname)'
ddcutil-2.2.1/src/util/sysfs_util.c:265:16: acquire_memory: allocated here
ddcutil-2.2.1/src/util/sysfs_util.c:267:7: branch_false: following 'false' branch...
 branch_false: ...to here
ddcutil-2.2.1/src/util/sysfs_util.c:273:25: danger: 'opendir(dirname)' leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  271|        else {
#  272|           struct dirent *dent2;
#  273|->         while ((dent2 = readdir(dir2)) != NULL) {
#  274|              DBGF(debug, "%s", dent2->d_name);
#  275|              if (!str_starts_with(dent2->d_name, ".")) {

Error: GCC_ANALYZER_WARNING (CWE-457): [#def989]
ddcutil-2.2.1/src/util/sysfs_util.c:415:10: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'buf[0]'
ddcutil-2.2.1/src/util/sysfs_util.c:389:1: enter_function: entry to 'rpt_attr_int'
ddcutil-2.2.1/src/util/sysfs_util.c:400:4: call_function: calling 'assemble_sysfs_path2' from 'rpt_attr_int'
ddcutil-2.2.1/src/util/sysfs_util.c:400:4: return_function: returning to 'rpt_attr_int' from 'assemble_sysfs_path2'
ddcutil-2.2.1/src/util/sysfs_util.c:411:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/sysfs_util.c:412:15: branch_true: ...to here
ddcutil-2.2.1/src/util/sysfs_util.c:413:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/sysfs_util.c:415:10: branch_false: ...to here
ddcutil-2.2.1/src/util/sysfs_util.c:415:10: danger: use of uninitialized value 'buf[0]' here
#  413|         if (!found) {
#  414|            char buf[40];
#  415|->          g_strdup_printf(buf, 40, "Not an integer: %s", sval);
#  416|            rpt_attr_output(depth, pb1, ": ", buf);
#  417|         }

Error: CPPCHECK_WARNING (CWE-476): [#def990]
ddcutil-2.2.1/src/util/timestamp.c:89: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: timestamp_history
#   87|            timestamp_history = calloc(MAX_TIMESTAMPS, sizeof(uint64_t));
#   88|         }
#   89|->       timestamp_history[timestamp_ct++] = result;
#   90|      }
#   91|      // printf("(%s) tv_sec=%ld, tv_nsec=%10ld, Returning: %"PRIu64"\n",

Error: GCC_ANALYZER_WARNING (CWE-476): [#def991]
ddcutil-2.2.1/src/util/timestamp.c:89:7: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'timestamp_history'
ddcutil-2.2.1/src/util/timestamp.c:84:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/timestamp.c:85:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/timestamp.c:86:10: branch_true: ...to here
ddcutil-2.2.1/src/util/timestamp.c:87:30: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/timestamp.c:89:7: danger: 'timestamp_history + (long unsigned int)timestamp_ct * 8' could be NULL: unchecked value from [(5)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/4)
#   87|            timestamp_history = calloc(MAX_TIMESTAMPS, sizeof(uint64_t));
#   88|         }
#   89|->       timestamp_history[timestamp_ct++] = result;
#   90|      }
#   91|      // printf("(%s) tv_sec=%ld, tv_nsec=%10ld, Returning: %"PRIu64"\n",

Error: GCC_ANALYZER_WARNING (CWE-401): [#def992]
ddcutil-2.2.1/src/util/traced_function_stack.c:132:62: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(g_queue_peek_nth(stack, (unsigned int)ndx))'
ddcutil-2.2.1/src/util/traced_function_stack.c:129:10: branch_true: following 'true' branch (when 'adjusted_len > 0')...
ddcutil-2.2.1/src/util/traced_function_stack.c:131:13: branch_true: ...to here
ddcutil-2.2.1/src/util/traced_function_stack.c:131:13: branch_true: following 'true' branch (when 'reverse != 0')...
ddcutil-2.2.1/src/util/traced_function_stack.c:132:22: branch_true: ...to here
ddcutil-2.2.1/src/util/traced_function_stack.c:132:41: branch_true: following 'true' branch (when 'stack_adjust <= ndx')...
ddcutil-2.2.1/src/util/traced_function_stack.c:133:50: branch_true: ...to here
ddcutil-2.2.1/src/util/traced_function_stack.c:133:43: acquire_memory: allocated here
ddcutil-2.2.1/src/util/traced_function_stack.c:132:62: danger: 'strdup(g_queue_peek_nth(stack, (unsigned int)ndx))' leaks here; was allocated at [(7)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/6)
#  130|            DBGF(debug, PRItid"traced function stack (addr=%p, adjusted_len=%d:", TID(), stack, adjusted_len );
#  131|            if (reverse) {
#  132|->             for (int ndx =  full_len-1; ndx >=stack_adjust ; ndx--) {
#  133|                  g_ptr_array_add(collector, strdup(g_queue_peek_nth(stack, ndx)));
#  134|               }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def993]
ddcutil-2.2.1/src/util/traced_function_stack.c:137:58: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(g_queue_peek_nth(stack, (unsigned int)ndx))'
ddcutil-2.2.1/src/util/traced_function_stack.c:129:10: branch_true: following 'true' branch (when 'adjusted_len > 0')...
ddcutil-2.2.1/src/util/traced_function_stack.c:131:13: branch_true: ...to here
ddcutil-2.2.1/src/util/traced_function_stack.c:131:13: branch_false: following 'false' branch (when 'reverse == 0')...
 branch_false: ...to here
ddcutil-2.2.1/src/util/traced_function_stack.c:137:42: branch_true: following 'true' branch (when 'full_len > ndx')...
ddcutil-2.2.1/src/util/traced_function_stack.c:138:50: branch_true: ...to here
ddcutil-2.2.1/src/util/traced_function_stack.c:138:43: acquire_memory: allocated here
ddcutil-2.2.1/src/util/traced_function_stack.c:137:58: danger: 'strdup(g_queue_peek_nth(stack, (unsigned int)ndx))' leaks here; was allocated at [(7)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/6)
#  135|            }
#  136|            else {
#  137|->             for (int ndx = stack_adjust; ndx < full_len; ndx++) {
#  138|                  g_ptr_array_add(collector, strdup(g_queue_peek_nth(stack, ndx)));
#  139|               }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def994]
ddcutil-2.2.1/src/util/traced_function_stack.c:219:38: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(g_queue_peek_nth(traced_function_stack, (unsigned int)ndx))'
ddcutil-2.2.1/src/util/traced_function_stack.c:218:7: branch_true: following 'true' branch (when 'most_recent_last != 0')...
 branch_true: ...to here
ddcutil-2.2.1/src/util/traced_function_stack.c:219:25: branch_true: following 'true' branch (when 'ndx < qsize')...
ddcutil-2.2.1/src/util/traced_function_stack.c:220:52: branch_true: ...to here
ddcutil-2.2.1/src/util/traced_function_stack.c:220:37: acquire_memory: allocated here
ddcutil-2.2.1/src/util/traced_function_stack.c:219:38: danger: 'strdup(g_queue_peek_nth(traced_function_stack, (unsigned int)ndx))' leaks here; was allocated at [(5)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/4)
#  217|      int qsize = g_queue_get_length(traced_function_stack);
#  218|      if (most_recent_last) {
#  219|->       for (int ndx = 0; ndx < qsize; ndx++) {
#  220|            g_ptr_array_add(callstack, strdup((char*) g_queue_peek_nth(traced_function_stack, ndx)));
#  221|         }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def995]
ddcutil-2.2.1/src/util/traced_function_stack.c:224:41: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(g_queue_peek_nth(traced_function_stack, (unsigned int)ndx))'
ddcutil-2.2.1/src/util/traced_function_stack.c:218:7: branch_false: following 'false' branch (when 'most_recent_last == 0')...
ddcutil-2.2.1/src/util/traced_function_stack.c:224:16: branch_false: ...to here
ddcutil-2.2.1/src/util/traced_function_stack.c:224:31: branch_true: following 'true' branch (when 'ndx >= 0')...
ddcutil-2.2.1/src/util/traced_function_stack.c:225:53: branch_true: ...to here
ddcutil-2.2.1/src/util/traced_function_stack.c:225:38: acquire_memory: allocated here
ddcutil-2.2.1/src/util/traced_function_stack.c:224:41: danger: 'strdup(g_queue_peek_nth(traced_function_stack, (unsigned int)ndx))' leaks here; was allocated at [(5)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/4)
#  222|      }
#  223|      else {
#  224|->       for (int ndx = qsize-1; ndx >= 0; ndx--) {
#  225|             g_ptr_array_add(callstack, strdup((char*) g_queue_peek_nth(traced_function_stack, ndx)));
#  226|          }

Error: CPPCHECK_WARNING (CWE-476): [#def996]
ddcutil-2.2.1/src/util/traced_function_stack.c:281: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: entry
#  279|               (GDestroyNotify) free_traced_function_stacks_entry);
#  280|      All_Traced_Function_Stacks_Entry * entry = calloc(1, sizeof(All_Traced_Function_Stacks_Entry));
#  281|->    entry->traced_function_stack = result;
#  282|      entry->thread_id = tid();
#  283|      entry->initial_function = strdup(funcname);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def997]
ddcutil-2.2.1/src/util/traced_function_stack.c:281:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'entry'
ddcutil-2.2.1/src/util/traced_function_stack.c:269:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/traced_function_stack.c:275:21: branch_false: ...to here
ddcutil-2.2.1/src/util/traced_function_stack.c:280:47: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/traced_function_stack.c:281:4: danger: 'entry' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/2)
#  279|               (GDestroyNotify) free_traced_function_stacks_entry);
#  280|      All_Traced_Function_Stacks_Entry * entry = calloc(1, sizeof(All_Traced_Function_Stacks_Entry));
#  281|->    entry->traced_function_stack = result;
#  282|      entry->thread_id = tid();
#  283|      entry->initial_function = strdup(funcname);

Error: CPPCHECK_WARNING (CWE-476): [#def998]
ddcutil-2.2.1/src/util/traced_function_stack.c:282: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: entry
#  280|      All_Traced_Function_Stacks_Entry * entry = calloc(1, sizeof(All_Traced_Function_Stacks_Entry));
#  281|      entry->traced_function_stack = result;
#  282|->    entry->thread_id = tid();
#  283|      entry->initial_function = strdup(funcname);
#  284|      // printf("entry=%p\n", entry);

Error: CPPCHECK_WARNING (CWE-476): [#def999]
ddcutil-2.2.1/src/util/traced_function_stack.c:283: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: entry
#  281|      entry->traced_function_stack = result;
#  282|      entry->thread_id = tid();
#  283|->    entry->initial_function = strdup(funcname);
#  284|      // printf("entry=%p\n", entry);
#  285|      g_ptr_array_add(all_traced_function_stacks, entry);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1000]
ddcutil-2.2.1/src/util/traced_function_stack.c:285:4: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/util/traced_function_stack.c:269:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/traced_function_stack.c:275:21: branch_false: ...to here
ddcutil-2.2.1/src/util/traced_function_stack.c:283:30: acquire_memory: allocated here
ddcutil-2.2.1/src/util/traced_function_stack.c:285:4: danger: '<unknown>' leaks here; was allocated at [(3)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/2)
#  283|      entry->initial_function = strdup(funcname);
#  284|      // printf("entry=%p\n", entry);
#  285|->    g_ptr_array_add(all_traced_function_stacks, entry);
#  286|      g_mutex_unlock(&all_traced_function_stacks_mutex);
#  287|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1001]
ddcutil-2.2.1/src/util/traced_function_stack.c:285:4: warning[-Wanalyzer-malloc-leak]: leak of 'entry'
ddcutil-2.2.1/src/util/traced_function_stack.c:269:12: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/traced_function_stack.c:275:21: branch_false: ...to here
ddcutil-2.2.1/src/util/traced_function_stack.c:280:47: acquire_memory: allocated here
ddcutil-2.2.1/src/util/traced_function_stack.c:285:4: danger: 'entry' leaks here; was allocated at [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2)
#  283|      entry->initial_function = strdup(funcname);
#  284|      // printf("entry=%p\n", entry);
#  285|->    g_ptr_array_add(all_traced_function_stacks, entry);
#  286|      g_mutex_unlock(&all_traced_function_stacks_mutex);
#  287|   

Error: GCC_ANALYZER_WARNING (CWE-404): [#def1002]
ddcutil-2.2.1/src/util/traced_function_stack.c:363:4: warning[-Wanalyzer-va-list-leak]: missing call to 'va_end'
ddcutil-2.2.1/src/util/traced_function_stack.c:362:4: acquire_resource: 'va_start' called here
ddcutil-2.2.1/src/util/traced_function_stack.c:363:4: danger: missing call to 'va_end' to match 'va_start' at [(1)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/0)
#  361|      va_list(args);
#  362|      va_start(args, format);
#  363|->    g_vsnprintf(msgbuf, 300, format, args);
#  364|      va_end(args);
#  365|      fprintf(stderr, "%s\n", msgbuf);

Error: CPPCHECK_WARNING (CWE-476): [#def1003]
ddcutil-2.2.1/src/util/udev_usb_util.c:26: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: devsum
#   24|   Usb_Detailed_Device_Summary * new_usb_detailed_device_summary() {
#   25|      Usb_Detailed_Device_Summary * devsum = calloc(1, sizeof(Usb_Detailed_Device_Summary));
#   26|->    memcpy(devsum->marker, UDEV_DETAILED_DEVICE_SUMMARY_MARKER, 4);
#   27|      return devsum;
#   28|   }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1004]
ddcutil-2.2.1/src/util/udev_usb_util.c:151:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'new_usb_detailed_device_summary()'
ddcutil-2.2.1/src/util/udev_usb_util.c:131:31: enter_function: entry to 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:132:4: branch_false: following 'false' branch (when 'devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:143:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:144:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: call_function: calling 'new_usb_detailed_device_summary' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: return_function: returning to 'lookup_udev_usb_device_by_devname' from 'new_usb_detailed_device_summary'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:22: call_function: inlined call to 'g_strdup_inline' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:4: danger: 'new_usb_detailed_device_summary()' could be NULL: unchecked value from [(8)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/7)
#  149|   
#  150|      Usb_Detailed_Device_Summary * devsum = new_usb_detailed_device_summary();
#  151|->    devsum->devname = g_strdup(devname);
#  152|   
#  153|      /* Create a list of matching devices. */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1005]
ddcutil-2.2.1/src/util/udev_usb_util.c:154:16: warning[-Wanalyzer-malloc-leak]: leak of 'new_usb_detailed_device_summary()'
ddcutil-2.2.1/src/util/udev_usb_util.c:131:31: enter_function: entry to 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:132:4: branch_false: following 'false' branch (when 'devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:143:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:144:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: call_function: calling 'new_usb_detailed_device_summary' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: return_function: returning to 'lookup_udev_usb_device_by_devname' from 'new_usb_detailed_device_summary'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:22: call_function: inlined call to 'g_strdup_inline' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:154:16: danger: 'new_usb_detailed_device_summary()' leaks here; was allocated at [(8)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/7)
#  152|   
#  153|      /* Create a list of matching devices. */
#  154|->    enumerate = udev_enumerate_new(udev);
#  155|      udev_enumerate_add_match_property(enumerate, "DEVNAME", devname);
#  156|      udev_enumerate_scan_devices(enumerate);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1006]
ddcutil-2.2.1/src/util/udev_usb_util.c:155:4: warning[-Wanalyzer-malloc-leak]: leak of 'new_usb_detailed_device_summary()'
ddcutil-2.2.1/src/util/udev_usb_util.c:131:31: enter_function: entry to 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:132:4: branch_false: following 'false' branch (when 'devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:143:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:144:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: call_function: calling 'new_usb_detailed_device_summary' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: return_function: returning to 'lookup_udev_usb_device_by_devname' from 'new_usb_detailed_device_summary'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:22: call_function: inlined call to 'g_strdup_inline' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:155:4: danger: 'new_usb_detailed_device_summary()' leaks here; was allocated at [(8)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/7)
#  153|      /* Create a list of matching devices. */
#  154|      enumerate = udev_enumerate_new(udev);
#  155|->    udev_enumerate_add_match_property(enumerate, "DEVNAME", devname);
#  156|      udev_enumerate_scan_devices(enumerate);
#  157|      devices = udev_enumerate_get_list_entry(enumerate);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1007]
ddcutil-2.2.1/src/util/udev_usb_util.c:156:4: warning[-Wanalyzer-malloc-leak]: leak of 'new_usb_detailed_device_summary()'
ddcutil-2.2.1/src/util/udev_usb_util.c:131:31: enter_function: entry to 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:132:4: branch_false: following 'false' branch (when 'devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:143:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:144:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: call_function: calling 'new_usb_detailed_device_summary' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: return_function: returning to 'lookup_udev_usb_device_by_devname' from 'new_usb_detailed_device_summary'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:22: call_function: inlined call to 'g_strdup_inline' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:156:4: danger: 'new_usb_detailed_device_summary()' leaks here; was allocated at [(8)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/7)
#  154|      enumerate = udev_enumerate_new(udev);
#  155|      udev_enumerate_add_match_property(enumerate, "DEVNAME", devname);
#  156|->    udev_enumerate_scan_devices(enumerate);
#  157|      devices = udev_enumerate_get_list_entry(enumerate);
#  158|      int devct = 0;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1008]
ddcutil-2.2.1/src/util/udev_usb_util.c:157:14: warning[-Wanalyzer-malloc-leak]: leak of 'new_usb_detailed_device_summary()'
ddcutil-2.2.1/src/util/udev_usb_util.c:131:31: enter_function: entry to 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:132:4: branch_false: following 'false' branch (when 'devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:143:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:144:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: call_function: calling 'new_usb_detailed_device_summary' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: return_function: returning to 'lookup_udev_usb_device_by_devname' from 'new_usb_detailed_device_summary'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:22: call_function: inlined call to 'g_strdup_inline' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:157:14: danger: 'new_usb_detailed_device_summary()' leaks here; was allocated at [(8)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/7)
#  155|      udev_enumerate_add_match_property(enumerate, "DEVNAME", devname);
#  156|      udev_enumerate_scan_devices(enumerate);
#  157|->    devices = udev_enumerate_get_list_entry(enumerate);
#  158|      int devct = 0;
#  159|      /*  udev_list_entry_foreach is a macro which expands to

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1009]
ddcutil-2.2.1/src/util/udev_usb_util.c:168:14: warning[-Wanalyzer-malloc-leak]: leak of 'new_usb_detailed_device_summary()'
ddcutil-2.2.1/src/util/udev_usb_util.c:131:31: enter_function: entry to 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:132:4: branch_false: following 'false' branch (when 'devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:143:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:144:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: call_function: calling 'new_usb_detailed_device_summary' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: return_function: returning to 'lookup_udev_usb_device_by_devname' from 'new_usb_detailed_device_summary'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:22: call_function: inlined call to 'g_strdup_inline' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:163:4: branch_true: following 'true' branch (when 'dev_list_entry' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:168:14: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:168:14: danger: 'new_usb_detailed_device_summary()' leaks here; was allocated at [(8)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/7)
#  166|         /* Get the filename of the /sys entry for the device
#  167|            and create a udev_device object (dev) representing it */
#  168|->       path = udev_list_entry_get_name(dev_list_entry);
#  169|         // rpt_vstring(depth, "path: %s", path);
#  170|         dev0 = udev_device_new_from_syspath(udev, path);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1010]
ddcutil-2.2.1/src/util/udev_usb_util.c:170:14: warning[-Wanalyzer-malloc-leak]: leak of 'new_usb_detailed_device_summary()'
ddcutil-2.2.1/src/util/udev_usb_util.c:131:31: enter_function: entry to 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:132:4: branch_false: following 'false' branch (when 'devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:143:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:144:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: call_function: calling 'new_usb_detailed_device_summary' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: return_function: returning to 'lookup_udev_usb_device_by_devname' from 'new_usb_detailed_device_summary'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:22: call_function: inlined call to 'g_strdup_inline' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:163:4: branch_true: following 'true' branch (when 'dev_list_entry' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:168:14: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:170:14: danger: 'new_usb_detailed_device_summary()' leaks here; was allocated at [(8)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/7)
#  168|         path = udev_list_entry_get_name(dev_list_entry);
#  169|         // rpt_vstring(depth, "path: %s", path);
#  170|->       dev0 = udev_device_new_from_syspath(udev, path);
#  171|   
#  172|         /* udev_device_get_devnode() returns the path to the device node

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1011]
ddcutil-2.2.1/src/util/udev_usb_util.c:184:13: warning[-Wanalyzer-malloc-leak]: leak of 'new_usb_detailed_device_summary()'
ddcutil-2.2.1/src/util/udev_usb_util.c:131:31: enter_function: entry to 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:132:4: branch_false: following 'false' branch (when 'devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:143:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:144:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: call_function: calling 'new_usb_detailed_device_summary' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: return_function: returning to 'lookup_udev_usb_device_by_devname' from 'new_usb_detailed_device_summary'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:22: call_function: inlined call to 'g_strdup_inline' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:163:4: branch_true: following 'true' branch (when 'dev_list_entry' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:168:14: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:184:13: danger: 'new_usb_detailed_device_summary()' leaks here; was allocated at [(8)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/7)
#  182|            be several levels up the tree, but the function will find
#  183|            it.*/
#  184|->       dev = udev_device_get_parent_with_subsystem_devtype(
#  185|                dev0,
#  186|                "usb",

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1012]
ddcutil-2.2.1/src/util/udev_usb_util.c:190:13: warning[-Wanalyzer-malloc-leak]: leak of 'new_usb_detailed_device_summary()'
ddcutil-2.2.1/src/util/udev_usb_util.c:131:31: enter_function: entry to 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:132:4: branch_false: following 'false' branch (when 'devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:143:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:144:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: call_function: calling 'new_usb_detailed_device_summary' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: return_function: returning to 'lookup_udev_usb_device_by_devname' from 'new_usb_detailed_device_summary'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:22: call_function: inlined call to 'g_strdup_inline' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:163:4: branch_true: following 'true' branch (when 'dev_list_entry' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:168:14: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:188:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:189:13: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:189:13: branch_true: following 'true' branch (when 'verbose != 0')...
ddcutil-2.2.1/src/util/udev_usb_util.c:190:13: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:190:13: danger: 'new_usb_detailed_device_summary()' leaks here; was allocated at [(8)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/7)
#  188|         if (!dev) {
#  189|            if (verbose)
#  190|->             rpt_vstring(depth, "Unable to find parent USB device.");
#  191|            udev_device_unref(dev0);
#  192|            continue;   // exit(1);   // TODO: fix

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1013]
ddcutil-2.2.1/src/util/udev_usb_util.c:191:10: warning[-Wanalyzer-malloc-leak]: leak of 'new_usb_detailed_device_summary()'
ddcutil-2.2.1/src/util/udev_usb_util.c:131:31: enter_function: entry to 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:132:4: branch_false: following 'false' branch (when 'devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:143:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:144:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: call_function: calling 'new_usb_detailed_device_summary' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: return_function: returning to 'lookup_udev_usb_device_by_devname' from 'new_usb_detailed_device_summary'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:22: call_function: inlined call to 'g_strdup_inline' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:163:4: branch_true: following 'true' branch (when 'dev_list_entry' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:168:14: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:188:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:189:13: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:191:10: danger: 'new_usb_detailed_device_summary()' leaks here; was allocated at [(8)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/7)
#  189|            if (verbose)
#  190|               rpt_vstring(depth, "Unable to find parent USB device.");
#  191|->          udev_device_unref(dev0);
#  192|            continue;   // exit(1);   // TODO: fix
#  193|         }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1014]
ddcutil-2.2.1/src/util/udev_usb_util.c:197:10: warning[-Wanalyzer-malloc-leak]: leak of 'new_usb_detailed_device_summary()'
ddcutil-2.2.1/src/util/udev_usb_util.c:131:31: enter_function: entry to 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:132:4: branch_false: following 'false' branch (when 'devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:143:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:144:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: call_function: calling 'new_usb_detailed_device_summary' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: return_function: returning to 'lookup_udev_usb_device_by_devname' from 'new_usb_detailed_device_summary'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:22: call_function: inlined call to 'g_strdup_inline' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:163:4: branch_true: following 'true' branch (when 'dev_list_entry' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:168:14: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:188:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:195:10: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:195:10: branch_true: following 'true' branch (when 'verbose != 0')...
ddcutil-2.2.1/src/util/udev_usb_util.c:196:10: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:197:10: danger: 'new_usb_detailed_device_summary()' leaks here; was allocated at [(8)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/7)
#  195|         if (verbose) {
#  196|            puts("");
#  197|->          rpt_vstring(depth, "Parent device:");
#  198|         }
#  199|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1015]
ddcutil-2.2.1/src/util/udev_usb_util.c:209:10: warning[-Wanalyzer-malloc-leak]: leak of 'new_usb_detailed_device_summary()'
ddcutil-2.2.1/src/util/udev_usb_util.c:131:31: enter_function: entry to 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:132:4: branch_false: following 'false' branch (when 'devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:143:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:144:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: call_function: calling 'new_usb_detailed_device_summary' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: return_function: returning to 'lookup_udev_usb_device_by_devname' from 'new_usb_detailed_device_summary'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:22: call_function: inlined call to 'g_strdup_inline' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:163:4: branch_true: following 'true' branch (when 'dev_list_entry' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:168:14: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:188:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:195:10: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:195:10: branch_true: following 'true' branch (when 'verbose != 0')...
ddcutil-2.2.1/src/util/udev_usb_util.c:196:10: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:209:10: danger: 'new_usb_detailed_device_summary()' leaks here; was allocated at [(8)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/7)
#  207|   
#  208|         if (verbose)
#  209|->          report_udev_device(dev, d1);
#  210|   
#  211|         devsum->vendor_id    = g_strdup( udev_device_get_sysattr_value(dev,"idVendor") );

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1016]
ddcutil-2.2.1/src/util/udev_usb_util.c:228:7: warning[-Wanalyzer-malloc-leak]: leak of 'new_usb_detailed_device_summary()'
ddcutil-2.2.1/src/util/udev_usb_util.c:131:31: enter_function: entry to 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:132:4: branch_false: following 'false' branch (when 'devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:143:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:144:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: call_function: calling 'new_usb_detailed_device_summary' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: return_function: returning to 'lookup_udev_usb_device_by_devname' from 'new_usb_detailed_device_summary'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:22: call_function: inlined call to 'g_strdup_inline' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:163:4: branch_true: following 'true' branch (when 'dev_list_entry' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:168:14: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:188:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:195:10: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:228:7: danger: 'new_usb_detailed_device_summary()' leaks here; was allocated at [(8)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/7)
#  226|         devsum->prop_minor  = g_strdup(udev_device_get_property_value(dev, "MINOR") );
#  227|   
#  228|->       hhs4_to_uint16(devsum->vendor_id, &devsum->vid);
#  229|         hhs4_to_uint16(devsum->product_id, &devsum->pid);
#  230|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1017]
ddcutil-2.2.1/src/util/udev_usb_util.c:236:4: warning[-Wanalyzer-malloc-leak]: leak of 'new_usb_detailed_device_summary()'
ddcutil-2.2.1/src/util/udev_usb_util.c:131:31: enter_function: entry to 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:132:4: branch_false: following 'false' branch (when 'devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:143:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:144:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: call_function: calling 'new_usb_detailed_device_summary' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: return_function: returning to 'lookup_udev_usb_device_by_devname' from 'new_usb_detailed_device_summary'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:22: call_function: inlined call to 'g_strdup_inline' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:236:4: danger: 'new_usb_detailed_device_summary()' leaks here; was allocated at [(8)](sarif:/runs/0/results/13/codeFlows/0/threadFlows/0/locations/7)
#  234|      }
#  235|      /* Free the enumerator object */
#  236|->    udev_enumerate_unref(enumerate);
#  237|   
#  238|      udev_unref(udev);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1018]
ddcutil-2.2.1/src/util/udev_usb_util.c:238:4: warning[-Wanalyzer-malloc-leak]: leak of 'new_usb_detailed_device_summary()'
ddcutil-2.2.1/src/util/udev_usb_util.c:131:31: enter_function: entry to 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:132:4: branch_false: following 'false' branch (when 'devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:143:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:144:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: call_function: calling 'new_usb_detailed_device_summary' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:150:43: return_function: returning to 'lookup_udev_usb_device_by_devname' from 'new_usb_detailed_device_summary'
ddcutil-2.2.1/src/util/udev_usb_util.c:151:22: call_function: inlined call to 'g_strdup_inline' from 'lookup_udev_usb_device_by_devname'
ddcutil-2.2.1/src/util/udev_usb_util.c:238:4: danger: 'new_usb_detailed_device_summary()' leaks here; was allocated at [(8)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/7)
#  236|      udev_enumerate_unref(enumerate);
#  237|   
#  238|->    udev_unref(udev);
#  239|   
#  240|      if (devct != 1)

Error: CPPCHECK_WARNING (CWE-476): [#def1019]
ddcutil-2.2.1/src/util/udev_usb_util.c:471: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  469|            result = calloc(1, sizeof(Udev_Usb_Devinfo));
#  470|            //are these decimal or hex numbers?
#  471|->          result->busno = atoi(sbusnum);
#  472|            result->devno = atoi(sdevnum);
#  473|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1020]
ddcutil-2.2.1/src/util/udev_usb_util.c:471:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'result'
ddcutil-2.2.1/src/util/udev_usb_util.c:383:4: branch_false: following 'false' branch (when 'subsystem' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:384:4: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:384:4: branch_false: following 'false' branch (when 'simple_devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:398:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:399:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:405:16: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:411:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:412:7: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:412:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:416:27: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:437:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:466:34: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:469:19: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/udev_usb_util.c:471:10: danger: 'result' could be NULL: unchecked value from [(13)](sarif:/runs/0/results/15/codeFlows/0/threadFlows/0/locations/12)
#  469|            result = calloc(1, sizeof(Udev_Usb_Devinfo));
#  470|            //are these decimal or hex numbers?
#  471|->          result->busno = atoi(sbusnum);
#  472|            result->devno = atoi(sdevnum);
#  473|   

Error: CPPCHECK_WARNING (CWE-476): [#def1021]
ddcutil-2.2.1/src/util/udev_usb_util.c:472: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: result
#  470|            //are these decimal or hex numbers?
#  471|            result->busno = atoi(sbusnum);
#  472|->          result->devno = atoi(sdevnum);
#  473|   
#  474|            // report_udev_device(dev, 1);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1022]
ddcutil-2.2.1/src/util/udev_usb_util.c:476:10: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/util/udev_usb_util.c:383:4: branch_false: following 'false' branch (when 'subsystem' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:384:4: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:384:4: branch_false: following 'false' branch (when 'simple_devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:398:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:399:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:405:16: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:411:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:412:7: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:412:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:416:27: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:437:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:466:34: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:469:19: acquire_memory: allocated here
ddcutil-2.2.1/src/util/udev_usb_util.c:476:10: danger: 'result' leaks here; was allocated at [(13)](sarif:/runs/0/results/16/codeFlows/0/threadFlows/0/locations/12)
#  474|            // report_udev_device(dev, 1);
#  475|   
#  476|->          udev_device_unref(dev);
#  477|         }
#  478|      }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1023]
ddcutil-2.2.1/src/util/udev_usb_util.c:480:4: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/util/udev_usb_util.c:383:4: branch_false: following 'false' branch (when 'subsystem' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:384:4: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:384:4: branch_false: following 'false' branch (when 'simple_devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:398:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:399:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:405:16: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:411:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:412:7: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:412:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:416:27: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:437:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:466:34: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:469:19: acquire_memory: allocated here
ddcutil-2.2.1/src/util/udev_usb_util.c:480:4: danger: 'result' leaks here; was allocated at [(13)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/12)
#  478|      }
#  479|      /* Free the enumerator object */
#  480|->    udev_enumerate_unref(enumerate);
#  481|   
#  482|      udev_unref(udev);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1024]
ddcutil-2.2.1/src/util/udev_usb_util.c:482:4: warning[-Wanalyzer-malloc-leak]: leak of 'result'
ddcutil-2.2.1/src/util/udev_usb_util.c:383:4: branch_false: following 'false' branch (when 'subsystem' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:384:4: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:384:4: branch_false: following 'false' branch (when 'simple_devname' is non-NULL)...
ddcutil-2.2.1/src/util/udev_usb_util.c:398:11: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:399:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:405:16: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:411:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:412:7: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:412:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:416:27: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:437:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_usb_util.c:466:34: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_usb_util.c:469:19: acquire_memory: allocated here
ddcutil-2.2.1/src/util/udev_usb_util.c:482:4: danger: 'result' leaks here; was allocated at [(13)](sarif:/runs/0/results/18/codeFlows/0/threadFlows/0/locations/12)
#  480|      udev_enumerate_unref(enumerate);
#  481|   
#  482|->    udev_unref(udev);
#  483|   
#  484|   bye:

Error: CPPCHECK_WARNING (CWE-476): [#def1025]
ddcutil-2.2.1/src/util/udev_util.c:70: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: summary
#   68|   Udev_Device_Summary * get_udev_device_summary(struct udev_device * dev) {
#   69|     Udev_Device_Summary * summary = calloc(1,sizeof(struct udev_device_summary));
#   70|->   memcpy(summary->marker, UDEV_DEVICE_SUMMARY_MARKER, 4);
#   71|     // n. all strings returned are const char *
#   72|     summary->devpath      = g_strdup(udev_device_get_devpath(dev));

Error: CPPCHECK_WARNING (CWE-476): [#def1026]
ddcutil-2.2.1/src/util/udev_util.c:72: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: summary
#   70|     memcpy(summary->marker, UDEV_DEVICE_SUMMARY_MARKER, 4);
#   71|     // n. all strings returned are const char *
#   72|->   summary->devpath      = g_strdup(udev_device_get_devpath(dev));
#   73|     summary->sysname      = g_strdup(udev_device_get_sysname(dev));
#   74|     summary->sysattr_name = g_strdup(udev_device_get_sysattr_value(dev, "name"));

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1027]
ddcutil-2.2.1/src/util/udev_util.c:72:3: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'summary'
ddcutil-2.2.1/src/util/udev_util.c:68:23: enter_function: entry to 'get_udev_device_summary'
ddcutil-2.2.1/src/util/udev_util.c:69:35: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/udev_util.c:72:3: danger: 'summary' could be NULL: unchecked value from [(2)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/1)
#   70|     memcpy(summary->marker, UDEV_DEVICE_SUMMARY_MARKER, 4);
#   71|     // n. all strings returned are const char *
#   72|->   summary->devpath      = g_strdup(udev_device_get_devpath(dev));
#   73|     summary->sysname      = g_strdup(udev_device_get_sysname(dev));
#   74|     summary->sysattr_name = g_strdup(udev_device_get_sysattr_value(dev, "name"));

Error: CPPCHECK_WARNING (CWE-476): [#def1028]
ddcutil-2.2.1/src/util/udev_util.c:73: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: summary
#   71|     // n. all strings returned are const char *
#   72|     summary->devpath      = g_strdup(udev_device_get_devpath(dev));
#   73|->   summary->sysname      = g_strdup(udev_device_get_sysname(dev));
#   74|     summary->sysattr_name = g_strdup(udev_device_get_sysattr_value(dev, "name"));
#   75|     summary->subsystem    = g_strdup(udev_device_get_subsystem(dev));

Error: CPPCHECK_WARNING (CWE-476): [#def1029]
ddcutil-2.2.1/src/util/udev_util.c:74: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: summary
#   72|     summary->devpath      = g_strdup(udev_device_get_devpath(dev));
#   73|     summary->sysname      = g_strdup(udev_device_get_sysname(dev));
#   74|->   summary->sysattr_name = g_strdup(udev_device_get_sysattr_value(dev, "name"));
#   75|     summary->subsystem    = g_strdup(udev_device_get_subsystem(dev));
#   76|     return summary;

Error: CPPCHECK_WARNING (CWE-476): [#def1030]
ddcutil-2.2.1/src/util/udev_util.c:75: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: summary
#   73|     summary->sysname      = g_strdup(udev_device_get_sysname(dev));
#   74|     summary->sysattr_name = g_strdup(udev_device_get_sysattr_value(dev, "name"));
#   75|->   summary->subsystem    = g_strdup(udev_device_get_subsystem(dev));
#   76|     return summary;
#   77|   }

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1031]
ddcutil-2.2.1/src/util/udev_util.c:123:7: warning[-Wanalyzer-malloc-leak]: leak of 'get_udev_device_summary(udev_device_new_from_syspath(udev_new(), udev_list_entry_get_name(dev_list_entry)))'
ddcutil-2.2.1/src/util/udev_util.c:88:13: enter_function: entry to 'summarize_udev_subsystem_devices'
ddcutil-2.2.1/src/util/udev_util.c:99:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_util.c:105:16: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_util.c:114:4: branch_true: following 'true' branch (when 'dev_list_entry' is non-NULL)...
ddcutil-2.2.1/src/util/udev_util.c:119:14: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_util.c:122:34: call_function: calling 'get_udev_device_summary' from 'summarize_udev_subsystem_devices'
ddcutil-2.2.1/src/util/udev_util.c:122:34: return_function: returning to 'summarize_udev_subsystem_devices' from 'get_udev_device_summary'
ddcutil-2.2.1/src/util/udev_util.c:123:7: danger: 'get_udev_device_summary(udev_device_new_from_syspath(udev_new(), udev_list_entry_get_name(dev_list_entry)))' leaks here; was allocated at [(8)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/7)
#  121|   
#  122|         g_ptr_array_add(summaries, get_udev_device_summary(dev));
#  123|->       udev_device_unref(dev);
#  124|      }
#  125|      udev_enumerate_unref(enumerate);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1032]
ddcutil-2.2.1/src/util/udev_util.c:171:7: warning[-Wanalyzer-malloc-leak]: leak of 'get_udev_device_summary(udev_device_new_from_syspath(udev_new(), udev_list_entry_get_name(dev_list_entry)))'
ddcutil-2.2.1/src/util/udev_util.c:141:13: enter_function: entry to 'find_devices_by_sysattr_name'
ddcutil-2.2.1/src/util/udev_util.c:151:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/udev_util.c:157:16: branch_false: ...to here
ddcutil-2.2.1/src/util/udev_util.c:164:4: branch_true: following 'true' branch (when 'dev_list_entry' is non-NULL)...
ddcutil-2.2.1/src/util/udev_util.c:167:27: branch_true: ...to here
ddcutil-2.2.1/src/util/udev_util.c:170:31: call_function: calling 'get_udev_device_summary' from 'find_devices_by_sysattr_name'
ddcutil-2.2.1/src/util/udev_util.c:170:31: return_function: returning to 'find_devices_by_sysattr_name' from 'get_udev_device_summary'
ddcutil-2.2.1/src/util/udev_util.c:171:7: danger: 'get_udev_device_summary(udev_device_new_from_syspath(udev_new(), udev_list_entry_get_name(dev_list_entry)))' leaks here; was allocated at [(8)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/7)
#  169|   
#  170|         g_ptr_array_add(result, get_udev_device_summary(dev));
#  171|->       udev_device_unref(dev);
#  172|      }
#  173|      udev_enumerate_unref(enumerate);

Error: CPPCHECK_WARNING (CWE-476): [#def1033]
ddcutil-2.2.1/src/util/x11_util.c:233: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: edidrec
#  231|                              // printf("found edid. nitems = %lu\n", nitems);
#  232|                              X11_Edid_Rec * edidrec = calloc(1, sizeof(X11_Edid_Rec));
#  233|->                            edidrec->edidbytes = calloc(1,128);
#  234|                              memcpy(edidrec->edidbytes, data, 128);
#  235|                              edidrec->output_name = calloc(1, output_info->nameLen + 1);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1034]
ddcutil-2.2.1/src/util/x11_util.c:233:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'edidrec'
ddcutil-2.2.1/src/util/x11_util.c:140:5: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:145:9: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:145:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:146:9: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:145:9: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:148:21: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:149:9: branch_true: following 'true' branch (when 'version > 257')...
ddcutil-2.2.1/src/util/x11_util.c:154:13: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:154:11: branch_true: following 'true' branch...
 branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:158:36: branch_true: following 'true' branch (when 'atom_count != 3')...
ddcutil-2.2.1/src/util/x11_util.c:160:18: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:172:11: branch_true: following 'true' branch (when 'atom_avail != 0')...
ddcutil-2.2.1/src/util/x11_util.c:174:15: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:177:25: branch_true: following 'true' branch (when 'screen < scr_count')...
ddcutil-2.2.1/src/util/x11_util.c:180:27: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:194:15: branch_true: following 'true' branch (when 'rsrc' is non-NULL)...
 branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:197:33: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:199:41: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:201:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:204:39: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:204:21: branch_true: following 'true' branch...
 branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:208:46: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:217:32: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:227:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:229:28: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:229:27: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:232:53: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/x11_util.c:233:28: danger: 'edidrec' could be NULL: unchecked value from [(31)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/30)
#  231|                              // printf("found edid. nitems = %lu\n", nitems);
#  232|                              X11_Edid_Rec * edidrec = calloc(1, sizeof(X11_Edid_Rec));
#  233|->                            edidrec->edidbytes = calloc(1,128);
#  234|                              memcpy(edidrec->edidbytes, data, 128);
#  235|                              edidrec->output_name = calloc(1, output_info->nameLen + 1);

Error: CPPCHECK_WARNING (CWE-476): [#def1035]
ddcutil-2.2.1/src/util/x11_util.c:234: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: edidrec
#  232|                              X11_Edid_Rec * edidrec = calloc(1, sizeof(X11_Edid_Rec));
#  233|                              edidrec->edidbytes = calloc(1,128);
#  234|->                            memcpy(edidrec->edidbytes, data, 128);
#  235|                              edidrec->output_name = calloc(1, output_info->nameLen + 1);
#  236|                              memcpy(edidrec->output_name, output_info->name, output_info->nameLen);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def1036]
ddcutil-2.2.1/src/util/x11_util.c:234:28: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'calloc(1, 128)' where non-null expected
ddcutil-2.2.1/src/util/x11_util.c:140:5: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:145:9: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:145:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:146:9: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:145:9: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:148:21: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:149:9: branch_true: following 'true' branch (when 'version > 257')...
ddcutil-2.2.1/src/util/x11_util.c:154:13: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:154:11: branch_true: following 'true' branch...
 branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:158:36: branch_true: following 'true' branch (when 'atom_count != 3')...
ddcutil-2.2.1/src/util/x11_util.c:160:18: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:172:11: branch_true: following 'true' branch (when 'atom_avail != 0')...
ddcutil-2.2.1/src/util/x11_util.c:174:15: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:177:25: branch_true: following 'true' branch (when 'screen < scr_count')...
ddcutil-2.2.1/src/util/x11_util.c:180:27: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:194:15: branch_true: following 'true' branch (when 'rsrc' is non-NULL)...
 branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:197:33: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:199:41: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:201:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:204:39: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:204:21: branch_true: following 'true' branch...
 branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:208:46: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:217:32: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:227:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:229:28: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:229:27: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:233:49: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/util/x11_util.c:234:28: danger: argument 1 ('calloc(1, 128)') from [(31)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/30) could be NULL where non-null expected
#argument 1 of '__builtin_memcpy' must be non-null
#  232|                              X11_Edid_Rec * edidrec = calloc(1, sizeof(X11_Edid_Rec));
#  233|                              edidrec->edidbytes = calloc(1,128);
#  234|->                            memcpy(edidrec->edidbytes, data, 128);
#  235|                              edidrec->output_name = calloc(1, output_info->nameLen + 1);
#  236|                              memcpy(edidrec->output_name, output_info->name, output_info->nameLen);

Error: CPPCHECK_WARNING (CWE-476): [#def1037]
ddcutil-2.2.1/src/util/x11_util.c:235: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: edidrec
#  233|                              edidrec->edidbytes = calloc(1,128);
#  234|                              memcpy(edidrec->edidbytes, data, 128);
#  235|->                            edidrec->output_name = calloc(1, output_info->nameLen + 1);
#  236|                              memcpy(edidrec->output_name, output_info->name, output_info->nameLen);
#  237|                              g_ptr_array_add(edid_recs, edidrec);

Error: CPPCHECK_WARNING (CWE-476): [#def1038]
ddcutil-2.2.1/src/util/x11_util.c:236: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: edidrec
#  234|                              memcpy(edidrec->edidbytes, data, 128);
#  235|                              edidrec->output_name = calloc(1, output_info->nameLen + 1);
#  236|->                            memcpy(edidrec->output_name, output_info->name, output_info->nameLen);
#  237|                              g_ptr_array_add(edid_recs, edidrec);
#  238|                              edid_found = true;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1039]
ddcutil-2.2.1/src/util/x11_util.c:237:28: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/util/x11_util.c:140:5: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:145:9: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:145:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:146:9: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:145:9: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:148:21: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:149:9: branch_true: following 'true' branch (when 'version > 257')...
ddcutil-2.2.1/src/util/x11_util.c:154:13: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:154:11: branch_true: following 'true' branch...
 branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:158:36: branch_true: following 'true' branch (when 'atom_count != 3')...
ddcutil-2.2.1/src/util/x11_util.c:160:18: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:172:11: branch_true: following 'true' branch (when 'atom_avail != 0')...
ddcutil-2.2.1/src/util/x11_util.c:174:15: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:177:25: branch_true: following 'true' branch (when 'screen < scr_count')...
ddcutil-2.2.1/src/util/x11_util.c:180:27: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:194:15: branch_true: following 'true' branch (when 'rsrc' is non-NULL)...
 branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:197:33: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:199:41: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:201:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:204:39: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:204:21: branch_true: following 'true' branch...
 branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:208:46: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:217:32: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:227:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:229:28: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:229:27: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:233:49: acquire_memory: allocated here
ddcutil-2.2.1/src/util/x11_util.c:237:28: danger: '<unknown>' leaks here; was allocated at [(31)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/30)
#  235|                              edidrec->output_name = calloc(1, output_info->nameLen + 1);
#  236|                              memcpy(edidrec->output_name, output_info->name, output_info->nameLen);
#  237|->                            g_ptr_array_add(edid_recs, edidrec);
#  238|                              edid_found = true;
#  239|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1040]
ddcutil-2.2.1/src/util/x11_util.c:237:28: warning[-Wanalyzer-malloc-leak]: leak of 'edidrec'
ddcutil-2.2.1/src/util/x11_util.c:140:5: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:145:9: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:145:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:146:9: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:145:9: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:148:21: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:149:9: branch_true: following 'true' branch (when 'version > 257')...
ddcutil-2.2.1/src/util/x11_util.c:154:13: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:154:11: branch_true: following 'true' branch...
 branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:158:36: branch_true: following 'true' branch (when 'atom_count != 3')...
ddcutil-2.2.1/src/util/x11_util.c:160:18: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:172:11: branch_true: following 'true' branch (when 'atom_avail != 0')...
ddcutil-2.2.1/src/util/x11_util.c:174:15: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:177:25: branch_true: following 'true' branch (when 'screen < scr_count')...
ddcutil-2.2.1/src/util/x11_util.c:180:27: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:194:15: branch_true: following 'true' branch (when 'rsrc' is non-NULL)...
 branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:197:33: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:199:41: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:201:19: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:204:39: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:204:21: branch_true: following 'true' branch...
 branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:208:46: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:217:32: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:227:25: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:229:28: branch_true: ...to here
ddcutil-2.2.1/src/util/x11_util.c:229:27: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/x11_util.c:232:53: acquire_memory: allocated here
ddcutil-2.2.1/src/util/x11_util.c:237:28: danger: 'edidrec' leaks here; was allocated at [(31)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/30)
#  235|                              edidrec->output_name = calloc(1, output_info->nameLen + 1);
#  236|                              memcpy(edidrec->output_name, output_info->name, output_info->nameLen);
#  237|->                            g_ptr_array_add(edid_recs, edidrec);
#  238|                              edid_found = true;
#  239|   

Error: CPPCHECK_WARNING (CWE-476): [#def1041]
ddcutil-2.2.1/src/util/xdg_util.c:329: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
#  327|      int len = p - state->iter_start;
#  328|      char * buf = calloc(len + 1, 1);
#  329|->    memcpy(buf, state->iter_start, len);
#  330|      state->iter_start = p + 1;
#  331|      if (debug)

Error: CPPCHECK_WARNING (CWE-476): [#def1042]
ddcutil-2.2.1/src/util/xdg_util.c:332: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
#  330|      state->iter_start = p + 1;
#  331|      if (debug)
#  332|->       printf("(%s) Returning: %s\n", __func__, buf);
#  333|      return buf;
#  334|   }

Error: GCC_ANALYZER_WARNING (CWE-688): [#def1043]
ddcutil-2.2.1/src/util/xdg_util.c:357:21: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'xdg_dirs_iter_next(&iter_state)' where non-null expected
ddcutil-2.2.1/src/util/xdg_util.c:338:15: enter_function: entry to 'find_xdg_path_file'
ddcutil-2.2.1/src/util/xdg_util.c:348:7: branch_false: following 'false' branch (when 'path' is non-NULL)...
ddcutil-2.2.1/src/util/xdg_util.c:354:18: call_function: inlined call to 'g_strdup_inline' from 'find_xdg_path_file'
ddcutil-2.2.1/src/util/xdg_util.c:356:12: branch_true: following 'true' branch (when 'fqfn' is NULL)...
ddcutil-2.2.1/src/util/xdg_util.c:356:33: branch_true: ...to here
ddcutil-2.2.1/src/util/xdg_util.c:356:33: call_function: calling 'xdg_dirs_iter_next' from 'find_xdg_path_file'
ddcutil-2.2.1/src/util/xdg_util.c:356:33: return_function: returning to 'find_xdg_path_file' from 'xdg_dirs_iter_next'
ddcutil-2.2.1/src/util/xdg_util.c:356:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/xdg_util.c:357:21: branch_true: ...to here
ddcutil-2.2.1/src/util/xdg_util.c:357:21: danger: argument 1 ('xdg_dirs_iter_next(&iter_state)') from [(11)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/10) could be NULL where non-null expected
#argument 1 of '__builtin_strlen' must be non-null
#  355|      xdg_dirs_iter_init(path2, &iter_state);
#  356|      while ( !fqfn && (next_dir = xdg_dirs_iter_next(&iter_state)) ) {
#  357|->       int lastndx = strlen(next_dir) - 1;
#  358|         if (next_dir[lastndx] == '/')
#  359|            next_dir[lastndx] = '\0';

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1044]
ddcutil-2.2.1/src/util/xdg_util.c:360:14: warning[-Wanalyzer-malloc-leak]: leak of 'xdg_dirs_iter_next(&iter_state)'
ddcutil-2.2.1/src/util/xdg_util.c:338:15: enter_function: entry to 'find_xdg_path_file'
ddcutil-2.2.1/src/util/xdg_util.c:348:7: branch_false: following 'false' branch (when 'path' is non-NULL)...
ddcutil-2.2.1/src/util/xdg_util.c:354:18: call_function: inlined call to 'g_strdup_inline' from 'find_xdg_path_file'
ddcutil-2.2.1/src/util/xdg_util.c:356:12: branch_true: following 'true' branch (when 'fqfn' is NULL)...
ddcutil-2.2.1/src/util/xdg_util.c:356:33: branch_true: ...to here
ddcutil-2.2.1/src/util/xdg_util.c:356:33: call_function: calling 'xdg_dirs_iter_next' from 'find_xdg_path_file'
ddcutil-2.2.1/src/util/xdg_util.c:356:33: return_function: returning to 'find_xdg_path_file' from 'xdg_dirs_iter_next'
ddcutil-2.2.1/src/util/xdg_util.c:356:12: branch_true: following 'true' branch...
ddcutil-2.2.1/src/util/xdg_util.c:357:21: branch_true: ...to here
ddcutil-2.2.1/src/util/xdg_util.c:358:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/util/xdg_util.c:360:14: branch_false: ...to here
ddcutil-2.2.1/src/util/xdg_util.c:360:14: danger: 'xdg_dirs_iter_next(&iter_state)' leaks here; was allocated at [(11)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/10)
#  358|         if (next_dir[lastndx] == '/')
#  359|            next_dir[lastndx] = '\0';
#  360|->       fqfn = g_strdup_printf("%s/%s/%s", next_dir, application, simple_fn);
#  361|         free(next_dir);
#  362|         if (debug)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1045]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:577:4: warning[-Wanalyzer-malloc-leak]: leak of 'segment'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:552:37: acquire_memory: allocated here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:559:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:577:4: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:577:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:577:4: branch_true: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:577:4: danger: 'segment' leaks here; was allocated at [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  575|      }
#  576|   
#  577|->    REQUIRE( *trimmed_start != '(' , "Missing segment name", pos);
#  578|      segment->name_start = trimmed_start;
#  579|      while (pos < end && *pos != '(' && *pos != ' ') {pos++;}  // name stops with either left paren or space

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1046]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:577:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'segment'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:552:37: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/vcp/parse_capabilities.c:559:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:577:4: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:577:4: branch_true: following 'true' branch...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:577:4: branch_true: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:577:4: danger: 'segment' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  575|      }
#  576|   
#  577|->    REQUIRE( *trimmed_start != '(' , "Missing segment name", pos);
#  578|      segment->name_start = trimmed_start;
#  579|      while (pos < end && *pos != '(' && *pos != ' ') {pos++;}  // name stops with either left paren or space

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1047]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:578:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'segment'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:552:37: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/vcp/parse_capabilities.c:559:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:577:4: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:577:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:578:4: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:578:4: danger: 'segment' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#  576|   
#  577|      REQUIRE( *trimmed_start != '(' , "Missing segment name", pos);
#  578|->    segment->name_start = trimmed_start;
#  579|      while (pos < end && *pos != '(' && *pos != ' ') {pos++;}  // name stops with either left paren or space
#  580|      REQUIRE( pos < end, "Nothing follows segment name", pos);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1048]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:580:4: warning[-Wanalyzer-malloc-leak]: leak of 'pcaps'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:769:22: enter_function: entry to 'parse_capabilities_string'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:772:4: branch_false: following 'false' branch (when 'caps' is non-NULL)...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:779:36: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:779:11: call_function: calling 'parse_capabilities' from 'parse_capabilities_string'
#  578|      segment->name_start = trimmed_start;
#  579|      while (pos < end && *pos != '(' && *pos != ' ') {pos++;}  // name stops with either left paren or space
#  580|->    REQUIRE( pos < end, "Nothing follows segment name", pos);
#  581|      segment->name_len = pos-trimmed_start;
#  582|      while ( pos < end && *pos == ' ' ) { pos++; }   // blanks following segment name

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1049]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:580:4: warning[-Wanalyzer-malloc-leak]: leak of 'segment'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:552:37: acquire_memory: allocated here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:559:7: branch_false: following 'false' branch...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:577:4: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:577:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:578:4: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:580:4: branch_true: following 'true' branch (when 'pos >= end')...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:580:4: branch_true: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:580:4: danger: 'segment' leaks here; was allocated at [(1)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/0)
#  578|      segment->name_start = trimmed_start;
#  579|      while (pos < end && *pos != '(' && *pos != ' ') {pos++;}  // name stops with either left paren or space
#  580|->    REQUIRE( pos < end, "Nothing follows segment name", pos);
#  581|      segment->name_len = pos-trimmed_start;
#  582|      while ( pos < end && *pos == ' ' ) { pos++; }   // blanks following segment name

Error: CPPCHECK_WARNING (CWE-476): [#def1050]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:652: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcaps
#  650|      char * capabilities_string_start = buf_start;
#  651|      Parsed_Capabilities* pcaps = calloc(1, sizeof(Parsed_Capabilities));
#  652|->    memcpy(pcaps->marker, PARSED_CAPABILITIES_MARKER, 4);
#  653|   
#  654|      // Explicitly initialize all fields as documentation

Error: CPPCHECK_WARNING (CWE-476): [#def1051]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:655: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcaps
#  653|   
#  654|      // Explicitly initialize all fields as documentation
#  655|->    pcaps->raw_value = chars_to_string(buf_start, buf_len);
#  656|      pcaps->raw_value_synthesized = false;   // set by user of function
#  657|      pcaps->mccs_version_string  = NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1052]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:655:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'pcaps'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:637:4: branch_false: following 'false' branch (when 'buf_start' is non-NULL)...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:639:4: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:651:33: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/vcp/parse_capabilities.c:655:4: danger: 'pcaps' could be NULL: unchecked value from [(3)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/2)
#  653|   
#  654|      // Explicitly initialize all fields as documentation
#  655|->    pcaps->raw_value = chars_to_string(buf_start, buf_len);
#  656|      pcaps->raw_value_synthesized = false;   // set by user of function
#  657|      pcaps->mccs_version_string  = NULL;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1053]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:655:23: warning[-Wanalyzer-malloc-leak]: leak of 'pcaps'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:637:4: branch_false: following 'false' branch (when 'buf_start' is non-NULL)...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:639:4: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:651:33: acquire_memory: allocated here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:655:23: danger: 'pcaps' leaks here; was allocated at [(3)](sarif:/runs/0/results/9/codeFlows/0/threadFlows/0/locations/2)
#  653|   
#  654|      // Explicitly initialize all fields as documentation
#  655|->    pcaps->raw_value = chars_to_string(buf_start, buf_len);
#  656|      pcaps->raw_value_synthesized = false;   // set by user of function
#  657|      pcaps->mccs_version_string  = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def1054]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:656: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcaps
#  654|      // Explicitly initialize all fields as documentation
#  655|      pcaps->raw_value = chars_to_string(buf_start, buf_len);
#  656|->    pcaps->raw_value_synthesized = false;   // set by user of function
#  657|      pcaps->mccs_version_string  = NULL;
#  658|      pcaps->parsed_mccs_version = DDCA_VSPEC_UNQUERIED;

Error: CPPCHECK_WARNING (CWE-476): [#def1055]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:657: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcaps
#  655|      pcaps->raw_value = chars_to_string(buf_start, buf_len);
#  656|      pcaps->raw_value_synthesized = false;   // set by user of function
#  657|->    pcaps->mccs_version_string  = NULL;
#  658|      pcaps->parsed_mccs_version = DDCA_VSPEC_UNQUERIED;
#  659|      pcaps->raw_cmds_segment_seen = false;

Error: CPPCHECK_WARNING (CWE-476): [#def1056]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:658: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcaps
#  656|      pcaps->raw_value_synthesized = false;   // set by user of function
#  657|      pcaps->mccs_version_string  = NULL;
#  658|->    pcaps->parsed_mccs_version = DDCA_VSPEC_UNQUERIED;
#  659|      pcaps->raw_cmds_segment_seen = false;
#  660|      pcaps->commands = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def1057]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:659: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcaps
#  657|      pcaps->mccs_version_string  = NULL;
#  658|      pcaps->parsed_mccs_version = DDCA_VSPEC_UNQUERIED;
#  659|->    pcaps->raw_cmds_segment_seen = false;
#  660|      pcaps->commands = NULL;
#  661|      pcaps->raw_vcp_features_seen = false;

Error: CPPCHECK_WARNING (CWE-476): [#def1058]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:660: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcaps
#  658|      pcaps->parsed_mccs_version = DDCA_VSPEC_UNQUERIED;
#  659|      pcaps->raw_cmds_segment_seen = false;
#  660|->    pcaps->commands = NULL;
#  661|      pcaps->raw_vcp_features_seen = false;
#  662|      pcaps->raw_cmds_segment_valid = false;

Error: CPPCHECK_WARNING (CWE-476): [#def1059]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:661: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcaps
#  659|      pcaps->raw_cmds_segment_seen = false;
#  660|      pcaps->commands = NULL;
#  661|->    pcaps->raw_vcp_features_seen = false;
#  662|      pcaps->raw_cmds_segment_valid = false;
#  663|      pcaps->caps_validity = CAPABILITIES_VALID;

Error: CPPCHECK_WARNING (CWE-476): [#def1060]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:662: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcaps
#  660|      pcaps->commands = NULL;
#  661|      pcaps->raw_vcp_features_seen = false;
#  662|->    pcaps->raw_cmds_segment_valid = false;
#  663|      pcaps->caps_validity = CAPABILITIES_VALID;
#  664|      pcaps->vcp_features = g_ptr_array_sized_new(40);

Error: CPPCHECK_WARNING (CWE-476): [#def1061]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:663: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcaps
#  661|      pcaps->raw_vcp_features_seen = false;
#  662|      pcaps->raw_cmds_segment_valid = false;
#  663|->    pcaps->caps_validity = CAPABILITIES_VALID;
#  664|      pcaps->vcp_features = g_ptr_array_sized_new(40);
#  665|      pcaps->messages = g_ptr_array_new();

Error: CPPCHECK_WARNING (CWE-476): [#def1062]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:664: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcaps
#  662|      pcaps->raw_cmds_segment_valid = false;
#  663|      pcaps->caps_validity = CAPABILITIES_VALID;
#  664|->    pcaps->vcp_features = g_ptr_array_sized_new(40);
#  665|      pcaps->messages = g_ptr_array_new();
#  666|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1063]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:664:26: warning[-Wanalyzer-malloc-leak]: leak of 'pcaps'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:637:4: branch_false: following 'false' branch (when 'buf_start' is non-NULL)...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:639:4: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:651:33: acquire_memory: allocated here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:664:26: danger: 'pcaps' leaks here; was allocated at [(3)](sarif:/runs/0/results/10/codeFlows/0/threadFlows/0/locations/2)
#  662|      pcaps->raw_cmds_segment_valid = false;
#  663|      pcaps->caps_validity = CAPABILITIES_VALID;
#  664|->    pcaps->vcp_features = g_ptr_array_sized_new(40);
#  665|      pcaps->messages = g_ptr_array_new();
#  666|   

Error: CPPCHECK_WARNING (CWE-476): [#def1064]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:665: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pcaps
#  663|      pcaps->caps_validity = CAPABILITIES_VALID;
#  664|      pcaps->vcp_features = g_ptr_array_sized_new(40);
#  665|->    pcaps->messages = g_ptr_array_new();
#  666|   
#  667|      // DBGMSG("Initial buf_len=%d, buf_start=%p -> |%.*s|", buf_len, buf_start, buf_len, buf_start);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1065]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:665:22: warning[-Wanalyzer-malloc-leak]: leak of 'pcaps'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:637:4: branch_false: following 'false' branch (when 'buf_start' is non-NULL)...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:639:4: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:651:33: acquire_memory: allocated here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:665:22: danger: 'pcaps' leaks here; was allocated at [(3)](sarif:/runs/0/results/11/codeFlows/0/threadFlows/0/locations/2)
#  663|      pcaps->caps_validity = CAPABILITIES_VALID;
#  664|      pcaps->vcp_features = g_ptr_array_sized_new(40);
#  665|->    pcaps->messages = g_ptr_array_new();
#  666|   
#  667|      // DBGMSG("Initial buf_len=%d, buf_start=%p -> |%.*s|", buf_len, buf_start, buf_len, buf_start);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1066]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:671:13: warning[-Wanalyzer-malloc-leak]: leak of 'pcaps'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:633:23: enter_function: entry to 'parse_capabilities'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:637:4: branch_false: following 'false' branch (when 'buf_start' is non-NULL)...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:639:4: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:651:33: acquire_memory: allocated here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:669:7: branch_true: following 'true' branch...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:670:21: branch_true: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:670:10: branch_true: following 'true' branch...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:672:29: call_function: inlined call to 'g_strdup_inline' from 'parse_capabilities'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:671:13: danger: 'pcaps' leaks here; was allocated at [(4)](sarif:/runs/0/results/12/codeFlows/0/threadFlows/0/locations/3)
#  669|      if (buf_start[0] == '(') {
#  670|         if (buf_start[buf_len-1] != ')') {
#  671|->             g_ptr_array_add(pcaps->messages,
#  672|                               g_strdup("Capabilities string lacks closing parenthesis"));
#  673|               pcaps->caps_validity = CAPABILITIES_INVALID;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1067]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:686:11: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:769:22: enter_function: entry to 'parse_capabilities_string'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:772:4: branch_false: following 'false' branch (when 'caps' is non-NULL)...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:779:36: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:779:11: call_function: calling 'parse_capabilities' from 'parse_capabilities_string'
#  684|         Capabilities_Segment * seg =
#  685|            next_capabilities_segment(buf_start, buf_len, pcaps->messages, capabilities_string_start);
#  686|->       if (seg->name_start == NULL)  {
#  687|            // error condition encountered
#  688|            pcaps->caps_validity = CAPABILITIES_INVALID;

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1068]
ddcutil-2.2.1/src/vcp/parse_capabilities.c:759:4: warning[-Wanalyzer-malloc-leak]: leak of 'pcaps'
ddcutil-2.2.1/src/vcp/parse_capabilities.c:637:4: branch_false: following 'false' branch (when 'buf_start' is non-NULL)...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:639:4: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:651:33: acquire_memory: allocated here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:683:11: branch_false: following 'false' branch (when 'buf_len <= 0')...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:758:1: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:759:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/vcp/parse_capabilities.c:759:4: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parse_capabilities.c:759:4: danger: 'pcaps' leaks here; was allocated at [(3)](sarif:/runs/0/results/14/codeFlows/0/threadFlows/0/locations/2)
#  757|   
#  758|   bye:
#  759|->    DBGTRC_RET_STRUCT(debug, DDCA_TRC_NONE, "Parsed_Capabilities", dbgrpt_parsed_capabilities, pcaps);
#  760|      return pcaps;
#  761|   }

Error: CPPCHECK_WARNING (CWE-476): [#def1069]
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:77: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: vfr
#   75|      Capabilities_Feature_Record * vfr =
#   76|            (Capabilities_Feature_Record *) calloc(1,sizeof(Capabilities_Feature_Record));
#   77|->    memcpy(vfr->marker, CAPABILITIES_FEATURE_MARKER, 4);
#   78|      vfr->feature_id = feature_id;
#   79|      // relying on calloc to 0 all other fields

Error: CPPCHECK_WARNING (CWE-476): [#def1070]
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:78: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: vfr
#   76|            (Capabilities_Feature_Record *) calloc(1,sizeof(Capabilities_Feature_Record));
#   77|      memcpy(vfr->marker, CAPABILITIES_FEATURE_MARKER, 4);
#   78|->    vfr->feature_id = feature_id;
#   79|      // relying on calloc to 0 all other fields
#   80|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1071]
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:78:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'vfr'
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:76:42: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:78:4: danger: 'vfr' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#   76|            (Capabilities_Feature_Record *) calloc(1,sizeof(Capabilities_Feature_Record));
#   77|      memcpy(vfr->marker, CAPABILITIES_FEATURE_MARKER, 4);
#   78|->    vfr->feature_id = feature_id;
#   79|      // relying on calloc to 0 all other fields
#   80|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1072]
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:91:37: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:81:7: branch_true: following 'true' branch (when 'value_string_start' is non-NULL)...
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:82:44: branch_true: ...to here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:82:36: acquire_memory: allocated here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:91:37: danger: '<unknown>' leaks here; was allocated at [(3)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/2)
#   89|   
#   90|   #ifdef CFR_BVA
#   91|->       Byte_Value_Array bva_values = bva_create();
#   92|         bool ok1 = store_bytehex_list(value_string_start, value_string_len, bva_values, bva_appender);
#   93|         if (!ok1) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1073]
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:91:37: warning[-Wanalyzer-malloc-leak]: leak of 'vfr'
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:76:42: acquire_memory: allocated here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:81:7: branch_true: following 'true' branch (when 'value_string_start' is non-NULL)...
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:82:44: branch_true: ...to here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:91:37: danger: 'vfr' leaks here; was allocated at [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#   89|   
#   90|   #ifdef CFR_BVA
#   91|->       Byte_Value_Array bva_values = bva_create();
#   92|         bool ok1 = store_bytehex_list(value_string_start, value_string_len, bva_values, bva_appender);
#   93|         if (!ok1) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1074]
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:92:18: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:81:7: branch_true: following 'true' branch (when 'value_string_start' is non-NULL)...
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:82:44: branch_true: ...to here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:82:36: acquire_memory: allocated here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:92:18: danger: '<unknown>' leaks here; was allocated at [(3)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/2)
#   90|   #ifdef CFR_BVA
#   91|         Byte_Value_Array bva_values = bva_create();
#   92|->       bool ok1 = store_bytehex_list(value_string_start, value_string_len, bva_values, bva_appender);
#   93|         if (!ok1) {
#   94|            char * s = g_strdup_printf("Invalid VCP value in list for feature x%02x: %.*s",

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1075]
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:92:18: warning[-Wanalyzer-malloc-leak]: leak of 'vfr'
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:76:42: acquire_memory: allocated here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:81:7: branch_true: following 'true' branch (when 'value_string_start' is non-NULL)...
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:82:44: branch_true: ...to here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:92:18: danger: 'vfr' leaks here; was allocated at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#   90|   #ifdef CFR_BVA
#   91|         Byte_Value_Array bva_values = bva_create();
#   92|->       bool ok1 = store_bytehex_list(value_string_start, value_string_len, bva_values, bva_appender);
#   93|         if (!ok1) {
#   94|            char * s = g_strdup_printf("Invalid VCP value in list for feature x%02x: %.*s",

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1076]
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:94:21: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:81:7: branch_true: following 'true' branch (when 'value_string_start' is non-NULL)...
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:82:44: branch_true: ...to here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:82:36: acquire_memory: allocated here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:93:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:94:21: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:94:21: danger: '<unknown>' leaks here; was allocated at [(3)](sarif:/runs/0/results/5/codeFlows/0/threadFlows/0/locations/2)
#   92|         bool ok1 = store_bytehex_list(value_string_start, value_string_len, bva_values, bva_appender);
#   93|         if (!ok1) {
#   94|->          char * s = g_strdup_printf("Invalid VCP value in list for feature x%02x: %.*s",
#   95|                       feature_id, value_string_len, value_string_start);
#   96|            g_ptr_array_add(error_messages, s);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1077]
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:94:21: warning[-Wanalyzer-malloc-leak]: leak of 'vfr'
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:76:42: acquire_memory: allocated here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:81:7: branch_true: following 'true' branch (when 'value_string_start' is non-NULL)...
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:82:44: branch_true: ...to here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:93:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:94:21: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:94:21: danger: 'vfr' leaks here; was allocated at [(1)](sarif:/runs/0/results/6/codeFlows/0/threadFlows/0/locations/0)
#   92|         bool ok1 = store_bytehex_list(value_string_start, value_string_len, bva_values, bva_appender);
#   93|         if (!ok1) {
#   94|->          char * s = g_strdup_printf("Invalid VCP value in list for feature x%02x: %.*s",
#   95|                       feature_id, value_string_len, value_string_start);
#   96|            g_ptr_array_add(error_messages, s);

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1078]
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:96:10: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:81:7: branch_true: following 'true' branch (when 'value_string_start' is non-NULL)...
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:82:44: branch_true: ...to here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:82:36: acquire_memory: allocated here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:93:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:94:21: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:96:10: danger: '<unknown>' leaks here; was allocated at [(3)](sarif:/runs/0/results/8/codeFlows/0/threadFlows/0/locations/2)
#   94|            char * s = g_strdup_printf("Invalid VCP value in list for feature x%02x: %.*s",
#   95|                       feature_id, value_string_len, value_string_start);
#   96|->          g_ptr_array_add(error_messages, s);
#   97|         }
#   98|         if (debug) {

Error: GCC_ANALYZER_WARNING (CWE-401): [#def1079]
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:96:10: warning[-Wanalyzer-malloc-leak]: leak of 'vfr'
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:76:42: acquire_memory: allocated here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:81:7: branch_true: following 'true' branch (when 'value_string_start' is non-NULL)...
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:82:44: branch_true: ...to here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:93:10: branch_false: following 'false' branch...
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:94:21: branch_false: ...to here
ddcutil-2.2.1/src/vcp/parsed_capabilities_feature.c:96:10: danger: 'vfr' leaks here; was allocated at [(1)](sarif:/runs/0/results/7/codeFlows/0/threadFlows/0/locations/0)
#   94|            char * s = g_strdup_printf("Invalid VCP value in list for feature x%02x: %.*s",
#   95|                       feature_id, value_string_len, value_string_start);
#   96|->          g_ptr_array_add(error_messages, s);
#   97|         }
#   98|         if (debug) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1080]
ddcutil-2.2.1/src/vcp/vcp_feature_codes.c:828:14: warning[-Wanalyzer-jump-through-null]: jump through null pointer
ddcutil-2.2.1/src/vcp/vcp_feature_codes.c:815:1: enter_function: entry to 'vcp_format_nontable_feature_detail'
ddcutil-2.2.1/src/vcp/vcp_feature_codes.c:827:10: call_function: calling 'get_nontable_feature_detail_function' from 'vcp_format_nontable_feature_detail'
ddcutil-2.2.1/src/vcp/vcp_feature_codes.c:827:10: return_function: returning to 'vcp_format_nontable_feature_detail' from 'get_nontable_feature_detail_function'
ddcutil-2.2.1/src/vcp/vcp_feature_codes.c:828:14: danger: jump through null pointer here
#  826|      Format_Normal_Feature_Detail_Function ffd_func =
#  827|            get_nontable_feature_detail_function(vfte, vcp_version);
#  828|->    bool ok = ffd_func(code_info, vcp_version,  buffer, bufsz);
#  829|      return ok;
#  830|   }

Error: CPPCHECK_WARNING (CWE-476): [#def1081]
ddcutil-2.2.1/src/vcp/vcp_feature_codes.c:957: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pentry
#  955|   vcp_new_feature_table_entry(DDCA_Vcp_Feature_Code id) {
#  956|      VCP_Feature_Table_Entry* pentry = calloc(1, sizeof(VCP_Feature_Table_Entry) );
#  957|->    pentry->code = id;
#  958|      memcpy(pentry->marker, VCP_FEATURE_TABLE_ENTRY_MARKER, 4);
#  959|      // DBGMSG("id=0x%02x.  Returning: %p", id, pentry);

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1082]
ddcutil-2.2.1/src/vcp/vcp_feature_codes.c:957:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'pentry'
ddcutil-2.2.1/src/vcp/vcp_feature_codes.c:956:38: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/vcp/vcp_feature_codes.c:957:4: danger: 'pentry' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  955|   vcp_new_feature_table_entry(DDCA_Vcp_Feature_Code id) {
#  956|      VCP_Feature_Table_Entry* pentry = calloc(1, sizeof(VCP_Feature_Table_Entry) );
#  957|->    pentry->code = id;
#  958|      memcpy(pentry->marker, VCP_FEATURE_TABLE_ENTRY_MARKER, 4);
#  959|      // DBGMSG("id=0x%02x.  Returning: %p", id, pentry);

Error: CPPCHECK_WARNING (CWE-476): [#def1083]
ddcutil-2.2.1/src/vcp/vcp_feature_codes.c:958: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pentry
#  956|      VCP_Feature_Table_Entry* pentry = calloc(1, sizeof(VCP_Feature_Table_Entry) );
#  957|      pentry->code = id;
#  958|->    memcpy(pentry->marker, VCP_FEATURE_TABLE_ENTRY_MARKER, 4);
#  959|      // DBGMSG("id=0x%02x.  Returning: %p", id, pentry);
#  960|      return pentry;

Error: CPPCHECK_WARNING (CWE-476): [#def1084]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:256: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  254|      DDCA_Any_Vcp_Value * valrec = calloc(1,sizeof(DDCA_Any_Vcp_Value));
#  255|   
#  256|->    valrec->value_type = DDCA_NON_TABLE_VCP_VALUE;
#  257|      valrec->opcode = feature_code;
#  258|      valrec->val.c_nc.mh = mh;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1085]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:256:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'valrec'
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:254:34: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:256:4: danger: 'valrec' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  254|      DDCA_Any_Vcp_Value * valrec = calloc(1,sizeof(DDCA_Any_Vcp_Value));
#  255|   
#  256|->    valrec->value_type = DDCA_NON_TABLE_VCP_VALUE;
#  257|      valrec->opcode = feature_code;
#  258|      valrec->val.c_nc.mh = mh;

Error: CPPCHECK_WARNING (CWE-476): [#def1086]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:257: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  255|   
#  256|      valrec->value_type = DDCA_NON_TABLE_VCP_VALUE;
#  257|->    valrec->opcode = feature_code;
#  258|      valrec->val.c_nc.mh = mh;
#  259|      valrec->val.c_nc.ml = ml;

Error: CPPCHECK_WARNING (CWE-476): [#def1087]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:258: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  256|      valrec->value_type = DDCA_NON_TABLE_VCP_VALUE;
#  257|      valrec->opcode = feature_code;
#  258|->    valrec->val.c_nc.mh = mh;
#  259|      valrec->val.c_nc.ml = ml;
#  260|      valrec->val.c_nc.sh = sh;

Error: CPPCHECK_WARNING (CWE-476): [#def1088]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:259: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  257|      valrec->opcode = feature_code;
#  258|      valrec->val.c_nc.mh = mh;
#  259|->    valrec->val.c_nc.ml = ml;
#  260|      valrec->val.c_nc.sh = sh;
#  261|      valrec->val.c_nc.sl = sl;

Error: CPPCHECK_WARNING (CWE-476): [#def1089]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:260: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  258|      valrec->val.c_nc.mh = mh;
#  259|      valrec->val.c_nc.ml = ml;
#  260|->    valrec->val.c_nc.sh = sh;
#  261|      valrec->val.c_nc.sl = sl;
#  262|      // not needed thanks to overlay

Error: CPPCHECK_WARNING (CWE-476): [#def1090]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:261: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  259|      valrec->val.c_nc.ml = ml;
#  260|      valrec->val.c_nc.sh = sh;
#  261|->    valrec->val.c_nc.sl = sl;
#  262|      // not needed thanks to overlay
#  263|      // valrec->val.nt.max_val = mh <<8 | ml;

Error: CPPCHECK_WARNING (CWE-476): [#def1091]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:276: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  274|   {
#  275|      DDCA_Any_Vcp_Value * valrec = calloc(1,sizeof(DDCA_Any_Vcp_Value));
#  276|->    valrec->value_type = DDCA_NON_TABLE_VCP_VALUE;
#  277|      valrec->opcode = feature_code;
#  278|      valrec->val.c_nc.mh = max_val >> 8;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1092]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:276:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'valrec'
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:275:34: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:276:4: danger: 'valrec' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/1/codeFlows/0/threadFlows/0/locations/0)
#  274|   {
#  275|      DDCA_Any_Vcp_Value * valrec = calloc(1,sizeof(DDCA_Any_Vcp_Value));
#  276|->    valrec->value_type = DDCA_NON_TABLE_VCP_VALUE;
#  277|      valrec->opcode = feature_code;
#  278|      valrec->val.c_nc.mh = max_val >> 8;

Error: CPPCHECK_WARNING (CWE-476): [#def1093]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:277: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  275|      DDCA_Any_Vcp_Value * valrec = calloc(1,sizeof(DDCA_Any_Vcp_Value));
#  276|      valrec->value_type = DDCA_NON_TABLE_VCP_VALUE;
#  277|->    valrec->opcode = feature_code;
#  278|      valrec->val.c_nc.mh = max_val >> 8;
#  279|      valrec->val.c_nc.ml = max_val & 0x0ff;

Error: CPPCHECK_WARNING (CWE-476): [#def1094]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:278: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  276|      valrec->value_type = DDCA_NON_TABLE_VCP_VALUE;
#  277|      valrec->opcode = feature_code;
#  278|->    valrec->val.c_nc.mh = max_val >> 8;
#  279|      valrec->val.c_nc.ml = max_val & 0x0ff;
#  280|      valrec->val.c_nc.sh = cur_val >> 8;

Error: CPPCHECK_WARNING (CWE-476): [#def1095]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:279: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  277|      valrec->opcode = feature_code;
#  278|      valrec->val.c_nc.mh = max_val >> 8;
#  279|->    valrec->val.c_nc.ml = max_val & 0x0ff;
#  280|      valrec->val.c_nc.sh = cur_val >> 8;
#  281|      valrec->val.c_nc.sl = cur_val & 0xff;

Error: CPPCHECK_WARNING (CWE-476): [#def1096]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:280: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  278|      valrec->val.c_nc.mh = max_val >> 8;
#  279|      valrec->val.c_nc.ml = max_val & 0x0ff;
#  280|->    valrec->val.c_nc.sh = cur_val >> 8;
#  281|      valrec->val.c_nc.sl = cur_val & 0xff;
#  282|      return valrec;

Error: CPPCHECK_WARNING (CWE-476): [#def1097]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:281: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  279|      valrec->val.c_nc.ml = max_val & 0x0ff;
#  280|      valrec->val.c_nc.sh = cur_val >> 8;
#  281|->    valrec->val.c_nc.sl = cur_val & 0xff;
#  282|      return valrec;
#  283|   }

Error: CPPCHECK_WARNING (CWE-476): [#def1098]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:293: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  291|   {
#  292|      DDCA_Any_Vcp_Value * valrec = calloc(1,sizeof(DDCA_Any_Vcp_Value));
#  293|->    valrec->value_type = DDCA_TABLE_VCP_VALUE;
#  294|      valrec->opcode = feature_code;
#  295|      valrec->val.t.bytect = bytect;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1099]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:293:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'valrec'
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:292:34: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:293:4: danger: 'valrec' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/0)
#  291|   {
#  292|      DDCA_Any_Vcp_Value * valrec = calloc(1,sizeof(DDCA_Any_Vcp_Value));
#  293|->    valrec->value_type = DDCA_TABLE_VCP_VALUE;
#  294|      valrec->opcode = feature_code;
#  295|      valrec->val.t.bytect = bytect;

Error: CPPCHECK_WARNING (CWE-476): [#def1100]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:294: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  292|      DDCA_Any_Vcp_Value * valrec = calloc(1,sizeof(DDCA_Any_Vcp_Value));
#  293|      valrec->value_type = DDCA_TABLE_VCP_VALUE;
#  294|->    valrec->opcode = feature_code;
#  295|      valrec->val.t.bytect = bytect;
#  296|      valrec->val.t.bytes = malloc(bytect);

Error: CPPCHECK_WARNING (CWE-476): [#def1101]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:295: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  293|      valrec->value_type = DDCA_TABLE_VCP_VALUE;
#  294|      valrec->opcode = feature_code;
#  295|->    valrec->val.t.bytect = bytect;
#  296|      valrec->val.t.bytes = malloc(bytect);
#  297|      memcpy(valrec->val.t.bytes, bytes, bytect);

Error: CPPCHECK_WARNING (CWE-476): [#def1102]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:296: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  294|      valrec->opcode = feature_code;
#  295|      valrec->val.t.bytect = bytect;
#  296|->    valrec->val.t.bytes = malloc(bytect);
#  297|      memcpy(valrec->val.t.bytes, bytes, bytect);
#  298|      return valrec;

Error: CPPCHECK_WARNING (CWE-476): [#def1103]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:297: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: valrec
#  295|      valrec->val.t.bytect = bytect;
#  296|      valrec->val.t.bytes = malloc(bytect);
#  297|->    memcpy(valrec->val.t.bytes, bytes, bytect);
#  298|      return valrec;
#  299|   }

Error: CPPCHECK_WARNING (CWE-476): [#def1104]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:374: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: non_table_response
#  372|      assert (valrec->value_type == DDCA_NON_TABLE_VCP_VALUE);
#  373|   
#  374|->    non_table_response->cur_value = VALREC_CUR_VAL(valrec);
#  375|      non_table_response->max_value = VALREC_MAX_VAL(valrec);
#  376|      non_table_response->mh        = valrec->val.c_nc.mh;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1105]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:374:4: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'non_table_response'
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:371:46: acquire_memory: this call could return NULL
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:372:4: branch_false: following 'false' branch...
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:374:36: branch_false: ...to here
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:374:4: danger: 'non_table_response' could be NULL: unchecked value from [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#  372|      assert (valrec->value_type == DDCA_NON_TABLE_VCP_VALUE);
#  373|   
#  374|->    non_table_response->cur_value = VALREC_CUR_VAL(valrec);
#  375|      non_table_response->max_value = VALREC_MAX_VAL(valrec);
#  376|      non_table_response->mh        = valrec->val.c_nc.mh;

Error: CPPCHECK_WARNING (CWE-476): [#def1106]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:375: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: non_table_response
#  373|   
#  374|      non_table_response->cur_value = VALREC_CUR_VAL(valrec);
#  375|->    non_table_response->max_value = VALREC_MAX_VAL(valrec);
#  376|      non_table_response->mh        = valrec->val.c_nc.mh;
#  377|      non_table_response->ml        = valrec->val.c_nc.ml;

Error: CPPCHECK_WARNING (CWE-476): [#def1107]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:376: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: non_table_response
#  374|      non_table_response->cur_value = VALREC_CUR_VAL(valrec);
#  375|      non_table_response->max_value = VALREC_MAX_VAL(valrec);
#  376|->    non_table_response->mh        = valrec->val.c_nc.mh;
#  377|      non_table_response->ml        = valrec->val.c_nc.ml;
#  378|      non_table_response->sh        = valrec->val.c_nc.sh;

Error: CPPCHECK_WARNING (CWE-476): [#def1108]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:377: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: non_table_response
#  375|      non_table_response->max_value = VALREC_MAX_VAL(valrec);
#  376|      non_table_response->mh        = valrec->val.c_nc.mh;
#  377|->    non_table_response->ml        = valrec->val.c_nc.ml;
#  378|      non_table_response->sh        = valrec->val.c_nc.sh;
#  379|      non_table_response->sl        = valrec->val.c_nc.sl;

Error: CPPCHECK_WARNING (CWE-476): [#def1109]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:378: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: non_table_response
#  376|      non_table_response->mh        = valrec->val.c_nc.mh;
#  377|      non_table_response->ml        = valrec->val.c_nc.ml;
#  378|->    non_table_response->sh        = valrec->val.c_nc.sh;
#  379|      non_table_response->sl        = valrec->val.c_nc.sl;
#  380|      non_table_response->vcp_code  = valrec->opcode;

Error: CPPCHECK_WARNING (CWE-476): [#def1110]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:379: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: non_table_response
#  377|      non_table_response->ml        = valrec->val.c_nc.ml;
#  378|      non_table_response->sh        = valrec->val.c_nc.sh;
#  379|->    non_table_response->sl        = valrec->val.c_nc.sl;
#  380|      non_table_response->vcp_code  = valrec->opcode;
#  381|   

Error: CPPCHECK_WARNING (CWE-476): [#def1111]
ddcutil-2.2.1/src/vcp/vcp_feature_values.c:380: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: non_table_response
#  378|      non_table_response->sh        = valrec->val.c_nc.sh;
#  379|      non_table_response->sl        = valrec->val.c_nc.sl;
#  380|->    non_table_response->vcp_code  = valrec->opcode;
#  381|   
#  382|      DBGMSF(debug, "Done. Returning: %p", non_table_response);

Scan Properties

analyzer-version-clippy1.90.0
analyzer-version-cppcheck2.18.3
analyzer-version-gcc15.2.1
analyzer-version-gcc-analyzer16.0.0
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-203.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250521.132812.g8eff701.main-1.el9.noarch
mock-configfedora-rawhide-gcc-latest-x86_64
project-nameddcutil-2.2.1-1.fc44
store-results-to/tmp/tmpij_e3tef/ddcutil-2.2.1-1.fc44.tar.xz
time-created2025-10-28 17:42:13
time-finished2025-10-28 17:45:15
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'gcc,cppcheck,shellcheck,clippy,unicontrol' '-o' '/tmp/tmpij_e3tef/ddcutil-2.2.1-1.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpij_e3tef/ddcutil-2.2.1-1.fc44.src.rpm'
tool-versioncsmock-3.8.3.20251027.143044.ge6b947b-1.el9