Skip to content

Commit

Permalink
mkcomposefs: Switch to declare-and-initialize to silence clang-analyzer
Browse files Browse the repository at this point in the history
clang-analyzer complains about a leak; I think it's wrong, but changing
things to atomically initialize the variables silences it.

Signed-off-by: Colin Walters <walters@verbum.org>
  • Loading branch information
cgwalters committed Aug 25, 2023
1 parent 29b9085 commit 4b35a7a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tools/mkcomposefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,13 @@ static int ensure_dir(const char *path, mode_t mode)

static int mkdir_parents(const char *pathname, int mode)
{
cleanup_free char *fn = NULL;
char *p;

fn = strdup(pathname);
cleanup_free char *fn = strdup(pathname);
if (fn == NULL) {
errno = ENOMEM;
return -1;
}

p = fn;
char *p = fn;
while (*p == '/')
p++;

Expand Down

0 comments on commit 4b35a7a

Please sign in to comment.