Skip to content

Commit 2b8dff3

Browse files
committed
main: fix memory leak when creating a whiteout
Closes: #222 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
1 parent 87a850d commit 2b8dff3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ static bool disable_ovl_whiteout;
166166
static uid_t overflow_uid;
167167
static gid_t overflow_gid;
168168

169+
static struct ovl_ino dummy_ino;
170+
169171
static double
170172
get_timeout (struct ovl_data *lo)
171173
{
@@ -747,7 +749,7 @@ node_free (void *p)
747749
n->parent = NULL;
748750
}
749751

750-
if (n->ino || n->node_lookups > 0)
752+
if ((n->ino && n->ino != &dummy_ino) || n->node_lookups > 0)
751753
return;
752754

753755
if (n->children)
@@ -1082,8 +1084,6 @@ node_set_name (struct ovl_node *node, char *name)
10821084
node->name_hash = hash_string (name, SIZE_MAX);
10831085
}
10841086

1085-
static struct ovl_ino dummy_ino;
1086-
10871087
static struct ovl_node *
10881088
make_whiteout_node (const char *path, const char *name)
10891089
{

0 commit comments

Comments
 (0)