Task #56212 - added.err

back to task #56212
download
Error: GCC_ANALYZER_WARNING (CWE-476):
crun-HEAD/libocispec/src/ocispec/image_spec_schema_defs.c: scope_hint: In function 'clone_image_spec_schema_defs_map_string_object'
crun-HEAD/libocispec/src/ocispec/image_spec_schema_defs.c:178:29: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'calloc(*src.len + 1, 8)'
#  176|           for (i = 0; i < src->len; i++)
#  177|             {
#  178|->              ret->values[i] = clone_image_spec_schema_defs_map_string_object_element (src->values[i]);
#  179|                if (ret->values[i] == NULL)
#  180|                  return NULL;

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:37:23: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
crun-HEAD/libocispec/yajl/src/api/yajl_tree.h:177:29: note: in expansion of macro 'YAJL_IS_OBJECT'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:24:9: note: in expansion of macro 'YAJL_GET_OBJECT'
crun-HEAD/libocispec/yajl/src/api/yajl_tree.h:177:29: note: in expansion of macro 'YAJL_IS_OBJECT'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:24:9: note: in expansion of macro 'YAJL_GET_OBJECT'
#   35|           if (ret->values == NULL)
#   36|             return NULL;
#   37|->         for (i = 0; i < len; i++)
#   38|             {
#   39|               yajl_val val;

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c: scope_hint: In function 'free_runtime_spec_schema_config_linux_net_devices'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:73:5: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
crun-HEAD/libocispec/yajl/src/api/yajl_tree.h:177:29: note: in expansion of macro 'YAJL_IS_OBJECT'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:24:9: note: in expansion of macro 'YAJL_GET_OBJECT'
crun-HEAD/libocispec/yajl/src/api/yajl_tree.h:177:29: note: in expansion of macro 'YAJL_IS_OBJECT'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:24:9: note: in expansion of macro 'YAJL_GET_OBJECT'
crun-HEAD/libocispec/src/ocispec/json_common.h:42:7: note: in definition of macro 'define_cleaner_function'
crun-HEAD/libocispec/src/ocispec/json_common.h:42:7: note: in definition of macro 'define_cleaner_function'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c: scope_hint: In function 'free_runtime_spec_schema_config_linux_net_devices'
#   71|           ptr->values = NULL;
#   72|         }
#   73|->     free (ptr);
#   74|   }
#   75|   

Error: CPPCHECK_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:3581: error[memleak]: Memory leak: ret
# 3579|           ret->boottime = clone_runtime_spec_schema_defs_linux_time_offsets (src->boottime);
# 3580|           if (ret->boottime == NULL)
# 3581|->           return NULL;
# 3582|         }
# 3583|       if (src->monotonic)

Error: CPPCHECK_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:3587: error[memleak]: Memory leak: ret
# 3585|           ret->monotonic = clone_runtime_spec_schema_defs_linux_time_offsets (src->monotonic);
# 3586|           if (ret->monotonic == NULL)
# 3587|->           return NULL;
# 3588|         }
# 3589|       return move_ptr (ret);

Error: CPPCHECK_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:4292: error[memleak]: Memory leak: ret
# 4290|           ret->devices = calloc (src->devices_len + 1, sizeof (*ret->devices));
# 4291|           if (ret->devices == NULL)
# 4292|->           return NULL;
# 4293|           for (size_t i = 0; i < src->devices_len; i++)
# 4294|             {

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_windows.c: scope_hint: In function 'make_runtime_spec_schema_config_windows_resources_cpu'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_windows.c:212:13: warning[-Wanalyzer-malloc-leak]: leak of 'make_runtime_spec_schema_config_windows_resources_cpu_affinity(get_val(tree, "affinity", 3), ctx,  err)'
#  210|       while (0);
#  211|   
#  212|->     if (tree->type == yajl_t_object)
#  213|         {
#  214|           size_t i;

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_windows.c: scope_hint: In function 'make_runtime_spec_schema_config_windows_resources'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_windows.c:414:34: warning[-Wanalyzer-malloc-leak]: leak of 'make_runtime_spec_schema_config_windows_resources_cpu(get_val(tree, "cpu", 3), ctx,  err)'
#  412|       while (0);
#  413|       ret->affinity = make_runtime_spec_schema_config_windows_resources_cpu_affinity (get_val (tree, "affinity", yajl_t_object), ctx, err);
#  414|->     if (ret->affinity == NULL && *err != 0)
#  415|         return NULL;
#  416|   

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_windows.c:417:8: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
#  415|         return NULL;
#  416|   
#  417|->     if (tree->type == yajl_t_object)
#  418|         {
#  419|           size_t i;

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_windows.c: scope_hint: In function 'clone_runtime_spec_schema_config_windows_resources'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_windows.c:561:21: warning[-Wanalyzer-malloc-leak]: leak of 'clone_runtime_spec_schema_config_windows_resources_cpu(*src.cpu)'
#  559|       if (ret == NULL)
#  560|         return NULL;
#  561|->     ret->count = src->count;
#  562|       ret->count_present = src->count_present;
#  563|       ret->shares = src->shares;

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_windows.c:570:12: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
#  568|         {
#  569|           ret->affinity = clone_runtime_spec_schema_config_windows_resources_cpu_affinity (src->affinity);
#  570|->         if (ret->affinity == NULL)
#  571|             return NULL;
#  572|         }

Error: CPPCHECK_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_windows.c:1913: error[memleak]: Memory leak: ret
# 1911|           ret->layer_folders = calloc (src->layer_folders_len + 1, sizeof (*ret->layer_folders));
# 1912|           if (ret->layer_folders == NULL)
# 1913|->           return NULL;
# 1914|           for (size_t i = 0; i < src->layer_folders_len; i++)
# 1915|             {

Error: CPPCHECK_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_defs_linux.c:2808: error[memleak]: Memory leak: ret
# 2806|           ret->path = strdup (src->path);
# 2807|           if (ret->path == NULL)
# 2808|->           return NULL;
# 2809|         }
# 2810|       return move_ptr (ret);

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_defs_zos.c: scope_hint: In function 'make_runtime_spec_schema_defs_zos_namespace_reference'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_defs_zos.c:102:12: warning[-Wanalyzer-malloc-leak]: leak of 'resi'
crun-HEAD/libocispec/src/ocispec/json_common.h:9: included_from: Included from here.
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_defs_zos.h:7: included_from: Included from here.
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_defs_zos.c:8: included_from: Included from here.
crun-HEAD/libocispec/yajl/src/api/yajl_tree.h:162:29: note: in expansion of macro 'YAJL_IS_STRING'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_defs_zos.c:29:25: note: in expansion of macro 'YAJL_GET_STRING'
#  100|             (void) fprintf (ctx->errfile, "WARNING: unknown key found\n");
#  101|   
#  102|->         if (ctx->options & OPT_PARSE_FULLKEY)
#  103|             ret->_residual = resi;
#  104|         }

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_features_linux.c:455:8: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_features_linux.c:310:28: note: in expansion of macro 'YAJL_IS_TRUE'
#  453|       while (0);
#  454|   
#  455|->     if (tree->type == yajl_t_object)
#  456|         {
#  457|           size_t i;

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_features_linux.c:455:13: warning[-Wanalyzer-malloc-leak]: leak of 'make_runtime_spec_schema_features_linux_seccomp(get_val(tree, "seccomp", 3), ctx,  err)'
#  453|       while (0);
#  454|   
#  455|->     if (tree->type == yajl_t_object)
#  456|         {
#  457|           size_t i;

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/json_common.h:9: included_from: Included from here.
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_windows.h:7: included_from: Included from here.
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_windows.c:8: included_from: Included from here.
crun-HEAD/libocispec/yajl/src/api/yajl_tree.h:151:49: warning[-Wanalyzer-malloc-leak]: leak of 'make_runtime_spec_schema_config_windows_resources_cpu(get_val(tree, "cpu", 3), ctx,  err)'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_windows.c:173:19: note: in expansion of macro 'YAJL_IS_NUMBER'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_windows.c:173:19: note: in expansion of macro 'YAJL_IS_NUMBER'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_windows.c:173:19: note: in expansion of macro 'YAJL_IS_NUMBER'
#  149|   /* Various convenience macros to check the type of a `yajl_val` */
#  150|   #define YAJL_IS_STRING(v) (((v) != NULL) && ((v)->type == yajl_t_string))
#  151|-> #define YAJL_IS_NUMBER(v) (((v) != NULL) && ((v)->type == yajl_t_number))
#  152|   #define YAJL_IS_INTEGER(v) (YAJL_IS_NUMBER(v) && ((v)->u.number.flags & YAJL_NUMBER_INT_VALID))
#  153|   #define YAJL_IS_DOUBLE(v) (YAJL_IS_NUMBER(v) && ((v)->u.number.flags & YAJL_NUMBER_DOUBLE_VALID))

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/src/ocispec/json_common.h:9: included_from: Included from here.
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.h:7: included_from: Included from here.
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:8: included_from: Included from here.
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c: scope_hint: In function 'make_runtime_spec_schema_config_linux'
crun-HEAD/libocispec/yajl/src/api/yajl_tree.h:154:49: warning[-Wanalyzer-malloc-leak]: leak of 'make_runtime_spec_schema_config_linux_net_devices(get_val(tree, "netDevices", 3), ctx,  err)'
crun-HEAD/libocispec/yajl/src/api/yajl_tree.h:177:29: note: in expansion of macro 'YAJL_IS_OBJECT'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:24:9: note: in expansion of macro 'YAJL_GET_OBJECT'
crun-HEAD/libocispec/yajl/src/api/yajl_tree.h:177:29: note: in expansion of macro 'YAJL_IS_OBJECT'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:24:9: note: in expansion of macro 'YAJL_GET_OBJECT'
crun-HEAD/libocispec/yajl/src/api/yajl_tree.h:177:29: note: in expansion of macro 'YAJL_IS_OBJECT'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:24:9: note: in expansion of macro 'YAJL_GET_OBJECT'
crun-HEAD/libocispec/yajl/src/api/yajl_tree.h:177:29: note: in expansion of macro 'YAJL_IS_OBJECT'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_config_linux.c:24:9: note: in expansion of macro 'YAJL_GET_OBJECT'
#  152|   #define YAJL_IS_INTEGER(v) (YAJL_IS_NUMBER(v) && ((v)->u.number.flags & YAJL_NUMBER_INT_VALID))
#  153|   #define YAJL_IS_DOUBLE(v) (YAJL_IS_NUMBER(v) && ((v)->u.number.flags & YAJL_NUMBER_DOUBLE_VALID))
#  154|-> #define YAJL_IS_OBJECT(v) (((v) != NULL) && ((v)->type == yajl_t_object))
#  155|   #define YAJL_IS_ARRAY(v)  (((v) != NULL) && ((v)->type == yajl_t_array ))
#  156|   #define YAJL_IS_TRUE(v)   (((v) != NULL) && ((v)->type == yajl_t_true  ))

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/libocispec/yajl/src/api/yajl_tree.h:156:49: warning[-Wanalyzer-malloc-leak]: leak of 'make_runtime_spec_schema_features_linux_seccomp(get_val(tree, "seccomp", 3), ctx,  err)'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_features_linux.c:310:28: note: in expansion of macro 'YAJL_IS_TRUE'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_features_linux.c:310:28: note: in expansion of macro 'YAJL_IS_TRUE'
crun-HEAD/libocispec/src/ocispec/runtime_spec_schema_features_linux.c:310:28: note: in expansion of macro 'YAJL_IS_TRUE'
#  154|   #define YAJL_IS_OBJECT(v) (((v) != NULL) && ((v)->type == yajl_t_object))
#  155|   #define YAJL_IS_ARRAY(v)  (((v) != NULL) && ((v)->type == yajl_t_array ))
#  156|-> #define YAJL_IS_TRUE(v)   (((v) != NULL) && ((v)->type == yajl_t_true  ))
#  157|   #define YAJL_IS_FALSE(v)  (((v) != NULL) && ((v)->type == yajl_t_false ))
#  158|   #define YAJL_IS_NULL(v)   (((v) != NULL) && ((v)->type == yajl_t_null  ))

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/src/libcrun/net_device.c:23: included_from: Included from here.
crun-HEAD/src/libcrun/utils.h: scope_hint: In function 'move_network_device'
crun-HEAD/src/libcrun/utils.h:65:21: warning[-Wanalyzer-malloc-leak]: leak of 'xmalloc(8192)'
crun-HEAD/src/libcrun/utils.h:57:40: note: in definition of macro 'UNLIKELY'
crun-HEAD/src/libcrun/utils.h:57:40: note: in definition of macro 'UNLIKELY'
#   63|   {
#   64|     void *res = malloc (size);
#   65|->   if (UNLIKELY (res == NULL))
#   66|       OOM ();
#   67|     return res;

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/src/libcrun/utils.h: scope_hint: In function 'libcrun_container_update'
crun-HEAD/src/libcrun/utils.h:74:21: warning[-Wanalyzer-malloc-leak]: leak of 'xmalloc0(184)'
crun-HEAD/src/libcrun/utils.h:57:40: note: in definition of macro 'UNLIKELY'
crun-HEAD/src/libcrun/container.c:582:7: note: in expansion of macro 'crun_make_error'
crun-HEAD/src/libcrun/container.c:1626:12: note: in expansion of macro 'crun_make_error'
crun-HEAD/src/libcrun/utils.h:57:40: note: in definition of macro 'UNLIKELY'
#   72|   {
#   73|     void *res = calloc (1, size);
#   74|->   if (UNLIKELY (res == NULL))
#   75|       OOM ();
#   76|     return res;

Error: GCC_ANALYZER_WARNING (CWE-401):
crun-HEAD/src/libcrun/utils.h: scope_hint: In function 'get_ip_addresses'
crun-HEAD/src/libcrun/utils.h:83:21: warning[-Wanalyzer-malloc-leak]: leak of 'xrealloc(ips,  ips_len + new_size + 12)'
crun-HEAD/src/libcrun/utils.h:57:40: note: in definition of macro 'UNLIKELY'
crun-HEAD/src/libcrun/utils.h:24: included_from: Included from here.
crun-HEAD/src/libcrun/utils.h:57:40: note: in definition of macro 'UNLIKELY'
#   81|   {
#   82|     void *res = realloc (ptr, size);
#   83|->   if (UNLIKELY (res == NULL))
#   84|       OOM ();
#   85|     return res;

Error: GCC_ANALYZER_WARNING (CWE-415):
crun-HEAD/src/libcrun/utils.h:92:3: warning[-Wanalyzer-double-free]: double-'free' of 'ips'
crun-HEAD/src/libcrun/net_device.c: scope_hint: In function 'get_ip_addresses'
#   90|   {
#   91|     void **pp = (void **) p;
#   92|->   free (*pp);
#   93|   }
#   94|   

Error: GCC_ANALYZER_WARNING (CWE-1341):
crun-HEAD/src/libcrun/utils.h:108:25: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor 'sock'
crun-HEAD/src/libcrun/utils.h: scope_hint: In function 'cleanup_closep.part.0'
#  106|     int *pp = (int *) p;
#  107|     if (*pp >= 0)
#  108|->     TEMP_FAILURE_RETRY (close (*pp));
#  109|   }
#  110|   

Error: GCC_ANALYZER_WARNING (CWE-1341):
crun-HEAD/src/libcrun/utils.h:108:25: warning[-Wanalyzer-fd-double-close]: double 'close' of file descriptor 'sock_in_ns'
crun-HEAD/src/libcrun/net_device.c: scope_hint: In function 'cleanup_closep.part.0'
crun-HEAD/src/libcrun/utils.h: scope_hint: In function 'cleanup_closep.part.0'
#  106|     int *pp = (int *) p;
#  107|     if (*pp >= 0)
#  108|->     TEMP_FAILURE_RETRY (close (*pp));
#  109|   }
#  110|