Task #115157 - added.err

back to task #115157
download
Error: CPPCHECK_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/basic_test_map_string_string_array.c:159: error[memleak]: Memory leak: ret
#  157|         ret->maps = calloc (src->maps_len + 1, sizeof (*ret->maps));
#  158|         if (ret->maps == NULL)
#  159|->         return NULL;
#  160|         for (size_t i = 0; i < src->maps_len; i++)
#  161|           {

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/image_spec_schema_content_descriptor.c: scope_hint: In function 'make_image_spec_schema_content_descriptor'
crun-HEAD/libocispec/src/ocispec/image_spec_schema_content_descriptor.c:83:16: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(<unknown>)'
#   81|               const char *str = json_object_get_string (val);
#   82|               ret->urls[i] = strdup (str ? str : "");
#   83|->             if (ret->urls[i] == NULL)
#   84|                 return NULL;
#   85|             }

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/image_spec_schema_image_index_schema.c: scope_hint: In function 'make_image_spec_schema_image_index_schema_manifests_element'
crun-HEAD/libocispec/src/ocispec/image_spec_schema_image_index_schema.c:395:16: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(<unknown>)'
#  393|               const char *str = json_object_get_string (val);
#  394|               ret->urls[i] = strdup (str ? str : "");
#  395|->             if (ret->urls[i] == NULL)
#  396|                 return NULL;
#  397|             }

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/json_common.c: scope_hint: In function 'free_json_map_string_int64.part.0'
crun-HEAD/libocispec/src/ocispec/json_common.c:1498:7: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
/usr/include/json-c/json.h:27: included_from: Included from here.
crun-HEAD/libocispec/src/ocispec/json_common.h:9: included_from: Included from here.
crun-HEAD/libocispec/src/ocispec/json_common.c:6: included_from: Included from here.
crun-HEAD/libocispec/src/ocispec/json_common.c: scope_hint: In function 'free_json_map_string_int64.part.0'
crun-HEAD/libocispec/src/ocispec/json_common.c:1506:1: note: in expansion of macro 'define_cleaner_function'
crun-HEAD/libocispec/src/ocispec/json_common.c: scope_hint: In function 'free_json_map_string_int64.part.0'
crun-HEAD/libocispec/src/ocispec/json_common.h:41:7: note: in definition of macro 'define_cleaner_function'
crun-HEAD/libocispec/src/ocispec/json_common.c: scope_hint: In function 'free_json_map_string_int64.part.0'
# 1496|             map->keys[i] = NULL;
# 1497|           }
# 1498|->       free (map->keys);
# 1499|         map->keys = NULL;
# 1500|         free (map->values);

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c: scope_hint: In function 'make_runtime_spec_schema_config_linux_seccomp'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:2526:16: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(<unknown>)'
# 2524|               const char *str = json_object_get_string (val);
# 2525|               ret->flags[i] = strdup (str ? str : "");
# 2526|->             if (ret->flags[i] == NULL)
# 2527|                 return NULL;
# 2528|             }

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:2572:16: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(<unknown>)'
# 2570|               const char *str = json_object_get_string (val);
# 2571|               ret->architectures[i] = strdup (str ? str : "");
# 2572|->             if (ret->architectures[i] == NULL)
# 2573|                 return NULL;
# 2574|             }

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_schema.c: scope_hint: In function 'make_runtime_spec_schema_config_schema_process_scheduler'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_schema.c:1903:16: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(<unknown>)'
# 1901|               const char *str = json_object_get_string (val);
# 1902|               ret->flags[i] = strdup (str ? str : "");
# 1903|->             if (ret->flags[i] == NULL)
# 1904|                 return NULL;
# 1905|             }

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_vm.c: scope_hint: In function 'make_runtime_spec_schema_config_vm_hw_config'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_vm.c:711:16: warning[-Wanalyzer-malloc-leak]: leak of 'strdup(<unknown>)'
#  709|               const char *str = json_object_get_string (val);
#  710|               ret->dtdevs[i] = strdup (str ? str : "");
#  711|->             if (ret->dtdevs[i] == NULL)
#  712|                 return NULL;
#  713|             }

Error: GCC_ANALYZER_WARNING (CWE-457):
crun-HEAD/src/libcrun/error.c: scope_hint: In function 'make_json_error'
crun-HEAD/src/libcrun/error.c:413:3: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'level'
#  411|   
#  412|     json_gen_string (gen, "level", strlen ("level"));
#  413|->   json_gen_string (gen, level, strlen (level));
#  414|   
#  415|     json_gen_string (gen, "time", strlen ("time"));

Error: GCC_ANALYZER_WARNING (CWE-688):
crun-HEAD/src/libcrun/linux.c: scope_hint: In function 'join_namespaces'
crun-HEAD/src/libcrun/linux.c:4130:17: warning[-Wanalyzer-null-argument]: use of NULL 'cwd' where non-null expected
/usr/include/unistd.h:517:12: note: argument 1 of 'chdir' must be non-null
# 4128|         if (value == CLONE_NEWNS)
# 4129|           {
# 4130|->           ret = chdir (cwd);
# 4131|             if (UNLIKELY (ret < 0))
# 4132|               return crun_make_error (err, errno, "chdir `%s`", cwd);

Error: GCC_ANALYZER_WARNING (CWE-1341):
crun-HEAD/src/libcrun/linux.c: scope_hint: In function 'libcrun_join_process'
crun-HEAD/src/libcrun/linux.c:5843:25: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor 'sync_socket_fd[0]'
# 5841|   exit:
# 5842|     if (sync_socket_fd[0] >= 0)
# 5843|->     TEMP_FAILURE_RETRY (close (sync_socket_fd[0]));
# 5844|     if (sync_socket_fd[1] >= 0)
# 5845|       TEMP_FAILURE_RETRY (close (sync_socket_fd[1]));

Error: GCC_ANALYZER_WARNING (CWE-1341):
crun-HEAD/src/libcrun/linux.c:5845:25: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor 'sync_socket_fd[1]'
# 5843|       TEMP_FAILURE_RETRY (close (sync_socket_fd[0]));
# 5844|     if (sync_socket_fd[1] >= 0)
# 5845|->     TEMP_FAILURE_RETRY (close (sync_socket_fd[1]));
# 5846|     return ret;
# 5847|   }

Error: GCC_ANALYZER_WARNING (CWE-1341):
crun-HEAD/src/libcrun/utils.h:213:33: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor '**cgroup_dirfd.dirfd'
crun-HEAD/src/libcrun/linux.c: scope_hint: In function 'close_and_reset.part.0'
#  211|     if (*fd >= 0)
#  212|       {
#  213|->       ret = TEMP_FAILURE_RETRY (close (*fd));
#  214|         if (LIKELY (ret == 0))
#  215|           *fd = -1;

Error: GCC_ANALYZER_WARNING (CWE-1341):
crun-HEAD/src/libcrun/utils.h:213:33: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor 'gid_fd'
crun-HEAD/src/libcrun/linux.c: scope_hint: In function 'close_and_reset.part.0'
crun-HEAD/src/libcrun/linux.c: scope_hint: In function 'close_and_reset.part.0'
crun-HEAD/src/libcrun/linux.c: scope_hint: In function 'close_and_reset.part.0'
crun-HEAD/src/libcrun/linux.c:443:16: note: in expansion of macro 'crun_make_error'
#  211|     if (*fd >= 0)
#  212|       {
#  213|->       ret = TEMP_FAILURE_RETRY (close (*fd));
#  214|         if (LIKELY (ret == 0))
#  215|           *fd = -1;

Error: GCC_ANALYZER_WARNING (CWE-1341):
crun-HEAD/src/libcrun/utils.h:213:33: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor 'targetfd'
crun-HEAD/src/libcrun/linux.c: scope_hint: In function 'close_and_reset.part.0'
crun-HEAD/src/libcrun/linux.c: scope_hint: In function 'close_and_reset.part.0'
crun-HEAD/src/libcrun/linux.c:4075:12: note: in expansion of macro 'crun_make_error'
crun-HEAD/src/libcrun/linux.c: scope_hint: In function 'close_and_reset.part.0'
crun-HEAD/src/libcrun/linux.c: scope_hint: In function 'close_and_reset.part.0'
crun-HEAD/src/libcrun/linux.c: scope_hint: In function 'close_and_reset.part.0'
#  211|     if (*fd >= 0)
#  212|       {
#  213|->       ret = TEMP_FAILURE_RETRY (close (*fd));
#  214|         if (LIKELY (ret == 0))
#  215|           *fd = -1;

Error: GCC_ANALYZER_WARNING (CWE-457):
crun-HEAD/src/libcrun/utils.h: scope_hint: In function 'xstrdup'
crun-HEAD/src/libcrun/utils.h:227:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value '*str'
crun-HEAD/src/libcrun/linux.c: scope_hint: In function 'xstrdup'
crun-HEAD/src/libcrun/linux.c: scope_hint: In function 'xstrdup'
crun-HEAD/src/libcrun/linux.c: scope_hint: In function 'xstrdup'
crun-HEAD/libocispec/src/ocispec/json_common.h:7: included_from: Included from here.
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_schema.h:7: included_from: Included from here.
crun-HEAD/src/libcrun/linux.h:27: included_from: Included from here.
/usr/include/string.h:202:14: note: argument 1 of 'strdup' must be a pointer to a null-terminated string
#  225|       return NULL;
#  226|   
#  227|->   ret = strdup (str);
#  228|     if (ret == NULL)
#  229|       OOM ();