Skip to content

Commit

Permalink
Merge pull request #189 from alexlarsson/fix-oom
Browse files Browse the repository at this point in the history
composefs-info: Fix memory handling for calloc
  • Loading branch information
cgwalters authored Sep 15, 2023
2 parents ca46d09 + 97a2f86 commit cca8be4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/composefs-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ static void print_objects(struct lcfs_node_s *node)
get_objects(node, ht);

size_t n_objects = hash_get_n_entries(ht);
char **objects = calloc(n_objects, sizeof(char *));
cleanup_free char **objects = calloc(n_objects, sizeof(char *));
if (objects == NULL)
errx(EXIT_FAILURE, "Out of memory");

hash_get_entries(ht, (void **)objects, n_objects);

Expand Down

0 comments on commit cca8be4

Please sign in to comment.