Skip to content

Commit

Permalink
main: fix memory leak when creating a whiteout
Browse files Browse the repository at this point in the history
Closes: #222

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Jun 29, 2020
1 parent 87a850d commit 2b8dff3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ static bool disable_ovl_whiteout;
static uid_t overflow_uid;
static gid_t overflow_gid;

static struct ovl_ino dummy_ino;

static double
get_timeout (struct ovl_data *lo)
{
Expand Down Expand Up @@ -747,7 +749,7 @@ node_free (void *p)
n->parent = NULL;
}

if (n->ino || n->node_lookups > 0)
if ((n->ino && n->ino != &dummy_ino) || n->node_lookups > 0)
return;

if (n->children)
Expand Down Expand Up @@ -1082,8 +1084,6 @@ node_set_name (struct ovl_node *node, char *name)
node->name_hash = hash_string (name, SIZE_MAX);
}

static struct ovl_ino dummy_ino;

static struct ovl_node *
make_whiteout_node (const char *path, const char *name)
{
Expand Down

0 comments on commit 2b8dff3

Please sign in to comment.