Task #112093 - fixed.err

back to task #112093
download
Error: CPPCHECK_WARNING (CWE-401):
crun-1.27/libocispec/src/ocispec/runtime_spec_schema_config_freebsd.c:447: error[memleak]: Memory leak: ret
#  445|           ret->mount = calloc (src->mount_len + 1, sizeof (*ret->mount));
#  446|           if (ret->mount == NULL)
#  447|->           return NULL;
#  448|           for (size_t i = 0; i < src->mount_len; i++)
#  449|             {

Error: CPPCHECK_WARNING (CWE-401):
crun-1.27/libocispec/src/ocispec/runtime_spec_schema_config_freebsd.c:1071: error[memleak]: Memory leak: ret
# 1069|           ret->parent = strdup (src->parent);
# 1070|           if (ret->parent == NULL)
# 1071|->           return NULL;
# 1072|         }
# 1073|       if (src->host != NULL)

Error: CPPCHECK_WARNING (CWE-401):
crun-1.27/libocispec/src/ocispec/runtime_spec_schema_config_freebsd.c:1077: error[memleak]: Memory leak: ret
# 1075|           ret->host = strdup (src->host);
# 1076|           if (ret->host == NULL)
# 1077|->           return NULL;
# 1078|         }
# 1079|       if (src->ip4 != NULL)

Error: CPPCHECK_WARNING (CWE-401):
crun-1.27/libocispec/src/ocispec/runtime_spec_schema_config_freebsd.c:1083: error[memleak]: Memory leak: ret
# 1081|           ret->ip4 = strdup (src->ip4);
# 1082|           if (ret->ip4 == NULL)
# 1083|->           return NULL;
# 1084|         }
# 1085|       if (src->ip4addr)

Error: CPPCHECK_WARNING (CWE-401):
crun-1.27/libocispec/src/ocispec/runtime_spec_schema_config_freebsd.c:1090: error[memleak]: Memory leak: ret
# 1088|           ret->ip4addr = calloc (src->ip4addr_len + 1, sizeof (*ret->ip4addr));
# 1089|           if (ret->ip4addr == NULL)
# 1090|->           return NULL;
# 1091|           for (size_t i = 0; i < src->ip4addr_len; i++)
# 1092|             {

Error: CPPCHECK_WARNING (CWE-401):
crun-1.27/libocispec/src/ocispec/runtime_spec_schema_config_freebsd.c:1367: error[memleak]: Memory leak: ret
# 1365|           ret->devices = calloc (src->devices_len + 1, sizeof (*ret->devices));
# 1366|           if (ret->devices == NULL)
# 1367|->           return NULL;
# 1368|           for (size_t i = 0; i < src->devices_len; i++)
# 1369|             {

Error: CPPCHECK_WARNING (CWE-401):
crun-1.27/libocispec/src/ocispec/runtime_spec_schema_config_vm.c:1309: error[memleak]: Memory leak: ret
# 1307|           ret->hypervisor = clone_runtime_spec_schema_config_vm_hypervisor (src->hypervisor);
# 1308|           if (ret->hypervisor == NULL)
# 1309|->           return NULL;
# 1310|         }
# 1311|       if (src->kernel)

Error: CPPCHECK_WARNING (CWE-401):
crun-1.27/libocispec/src/ocispec/runtime_spec_schema_config_vm.c:1315: error[memleak]: Memory leak: ret
# 1313|           ret->kernel = clone_runtime_spec_schema_config_vm_kernel (src->kernel);
# 1314|           if (ret->kernel == NULL)
# 1315|->           return NULL;
# 1316|         }
# 1317|       if (src->image)

Error: CPPCHECK_WARNING (CWE-401):
crun-1.27/libocispec/src/ocispec/runtime_spec_schema_config_vm.c:1321: error[memleak]: Memory leak: ret
# 1319|           ret->image = clone_runtime_spec_schema_config_vm_image (src->image);
# 1320|           if (ret->image == NULL)
# 1321|->           return NULL;
# 1322|         }
# 1323|       if (src->hw_config)

Error: CPPCHECK_WARNING (CWE-401):
crun-1.27/libocispec/src/ocispec/runtime_spec_schema_config_vm.c:1327: error[memleak]: Memory leak: ret
# 1325|           ret->hw_config = clone_runtime_spec_schema_config_vm_hw_config (src->hw_config);
# 1326|           if (ret->hw_config == NULL)
# 1327|->           return NULL;
# 1328|         }
# 1329|       return move_ptr (ret);

Error: CPPCHECK_WARNING (CWE-401):
crun-1.27/libocispec/src/ocispec/runtime_spec_schema_defs_freebsd.c:180: error[memleak]: Memory leak: ret
#  178|           ret->path = strdup (src->path);
#  179|           if (ret->path == NULL)
#  180|->           return NULL;
#  181|         }
#  182|       ret->mode = src->mode;

Error: COMPILER_WARNING (CWE-704):
crun-1.27/src/libcrun/cgroup-systemd.c: scope_hint: In function 'get_systemd_scope_and_slice'
crun-1.27/src/libcrun/cgroup-systemd.c:125:5: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
#  125 |   n = strchr (cgroup_path, ':');
#      |     ^
#  123|       }
#  124|   
#  125|->   n = strchr (cgroup_path, ':');
#  126|     if (n == NULL)
#  127|       xasprintf (scope, "%s.scope", cgroup_path);

Error: COMPILER_WARNING (CWE-704):
crun-1.27/src/libcrun/cgroup-systemd.c:125:5: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
#  123|       }
#  124|   
#  125|->   n = strchr (cgroup_path, ':');
#  126|     if (n == NULL)
#  127|       xasprintf (scope, "%s.scope", cgroup_path);

Error: COMPILER_WARNING (CWE-704):
crun-1.27/src/libcrun/cgroup-systemd.c: scope_hint: In function 'append_systemd_annotation'
crun-1.27/src/libcrun/cgroup-systemd.c:641:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
#  641 |       end = strchr (it + 1, '\'');
#      |           ^
#  639|         it = v_start = xstrdup (value);
#  640|   
#  641|->       end = strchr (it + 1, '\'');
#  642|         if (end == NULL)
#  643|           return crun_make_error (err, 0, "invalid variant `%s`", value);

Error: COMPILER_WARNING (CWE-704):
crun-1.27/src/libcrun/cgroup-systemd.c:641:11: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
#  639|         it = v_start = xstrdup (value);
#  640|   
#  641|->       end = strchr (it + 1, '\'');
#  642|         if (end == NULL)
#  643|           return crun_make_error (err, 0, "invalid variant `%s`", value);

Error: COMPILER_WARNING (CWE-704):
crun-1.27/src/libcrun/error.c: scope_hint: In function 'get_log_type'
crun-1.27/src/libcrun/error.c:194:15: warning[-Wdiscarded-qualifiers]: initialization discards 'const' qualifier from pointer target type
#  194 |   char *sep = strchr (log, ':');
#      |               ^~~~~~
#  192|   get_log_type (const char *log, const char **data)
#  193|   {
#  194|->   char *sep = strchr (log, ':');
#  195|     if (sep == NULL)
#  196|       {

Error: COMPILER_WARNING (CWE-704):
crun-1.27/src/libcrun/error.c:194:15: warning[-Wdiscarded-qualifiers]: initialization discards 'const' qualifier from pointer target type
#  192|   get_log_type (const char *log, const char **data)
#  193|   {
#  194|->   char *sep = strchr (log, ':');
#  195|     if (sep == NULL)
#  196|       {

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-1.27/src/libcrun/linux.c:6471:1: warning[-Wanalyzer-malloc-leak]: leak of 'data'
crun-1.27/src/libcrun/linux.c:6402:1: enter_function: entry to 'libcrun_make_runtime_mounts'
crun-1.27/src/libcrun/linux.c:6411:9: call_function: calling 'make_libcrun_fd_map' from 'libcrun_make_runtime_mounts'
crun-1.27/src/libcrun/linux.c:6411:9: return_function: returning to 'libcrun_make_runtime_mounts' from 'make_libcrun_fd_map'
crun-1.27/src/libcrun/linux.c:6413:15: branch_true: following 'true' branch (when 'i < len')...
crun-1.27/src/libcrun/linux.c:6415:42: branch_true: ...to here
crun-1.27/src/libcrun/linux.c:6423:13: call_function: calling 'maybe_get_idmapped_mount' from 'libcrun_make_runtime_mounts'
crun-1.27/src/libcrun/linux.c:6423:13: return_function: returning to 'libcrun_make_runtime_mounts' from 'maybe_get_idmapped_mount'
crun-1.27/src/libcrun/linux.c:6424:10: branch_false: following 'false' branch...
crun-1.27/src/libcrun/linux.c:6427:11: branch_false: ...to here
crun-1.27/src/libcrun/linux.c:6427:10: branch_true: following 'true' branch...
crun-1.27/src/libcrun/linux.c:6429:16: branch_true: ...to here
crun-1.27/src/libcrun/linux.c:6432:15: call_function: calling 'is_bind_mount' from 'libcrun_make_runtime_mounts'
crun-1.27/src/libcrun/linux.c:6432:15: return_function: returning to 'libcrun_make_runtime_mounts' from 'is_bind_mount'
crun-1.27/src/libcrun/linux.c:6440:21: call_function: calling 'open_mount_of_type' from 'libcrun_make_runtime_mounts'
crun-1.27/src/libcrun/linux.c:6440:21: return_function: returning to 'libcrun_make_runtime_mounts' from 'open_mount_of_type'
crun-1.27/src/libcrun/linux.c:6441:18: branch_false: following 'false' branch...
crun-1.27/src/libcrun/linux.c:6471:1: branch_false: ...to here
crun-1.27/src/libcrun/linux.c:6446:10: branch_true: following 'true' branch...
crun-1.27/src/libcrun/linux.c:6447:47: branch_true: ...to here
crun-1.27/src/libcrun/linux.c:6447:17: call_function: calling 'get_default_flags' from 'libcrun_make_runtime_mounts'
crun-1.27/src/libcrun/linux.c:6447:17: return_function: returning to 'libcrun_make_runtime_mounts' from 'get_default_flags'
crun-1.27/src/libcrun/linux.c:6456:13: call_function: calling 'do_mount_setattr' from 'libcrun_make_runtime_mounts'
crun-1.27/src/libcrun/linux.c:6456:13: return_function: returning to 'libcrun_make_runtime_mounts' from 'do_mount_setattr'
crun-1.27/src/libcrun/linux.c:6471:1: danger: 'data' leaks here; was allocated at [(59)](sarif:/runs/0/results/20/codeFlows/0/threadFlows/0/locations/58)
# 6469|   
# 6470|     return run_in_container_namespace (status, do_mount_in_a_container, &args, err);
# 6471|-> }
# 6472|   
# 6473|   int

Error: COMPILER_WARNING (CWE-704):
crun-1.27/src/libcrun/utils.c: scope_hint: In function 'crun_safe_ensure_at'
crun-1.27/src/libcrun/utils.c:578:10: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
#  578 |       it = strchr (cur, '/');
#      |          ^
#  576|         cur = consume_slashes (it + 1);
#  577|         *it = '/';
#  578|->       it = strchr (cur, '/');
#  579|       }
#  580|   

Error: COMPILER_WARNING (CWE-704):
crun-1.27/src/libcrun/utils.c:578:10: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
#  576|         cur = consume_slashes (it + 1);
#  577|         *it = '/';
#  578|->       it = strchr (cur, '/');
#  579|       }
#  580|