Skip to content

Commit

Permalink
Merge pull request #246 from eriksjolund/handle-null-from-strndup
Browse files Browse the repository at this point in the history
mkcomposefs: Handle NULL from strndup()
  • Loading branch information
cgwalters authored Feb 1, 2024
2 parents e63786d + bdc2c4c commit e9632ca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/mkcomposefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ static struct lcfs_node_s *lookup_parent_path(struct lcfs_node_s *node,
}

cleanup_free char *name = strndup(start, path - start);
if (name == NULL)
oom();

struct lcfs_node_s *child = lcfs_node_lookup_child(node, name);
if (child == NULL)
Expand All @@ -233,6 +235,8 @@ static struct lcfs_node_s *lookup_path(struct lcfs_node_s *node, const char *pat
path++;

cleanup_free char *name = strndup(start, path - start);
if (name == NULL)
oom();

struct lcfs_node_s *child = lcfs_node_lookup_child(node, name);
if (child == NULL)
Expand Down

0 comments on commit e9632ca

Please sign in to comment.