main: fix memory leak when creating a whiteout

Closes: https://github.com/containers/fuse-overlayfs/issues/222

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2020-06-29 13:54:11 +02:00
parent 87a850d616
commit 2b8dff330f
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED

6
main.c
View File

@ -166,6 +166,8 @@ static bool disable_ovl_whiteout;
static uid_t overflow_uid; static uid_t overflow_uid;
static gid_t overflow_gid; static gid_t overflow_gid;
static struct ovl_ino dummy_ino;
static double static double
get_timeout (struct ovl_data *lo) get_timeout (struct ovl_data *lo)
{ {
@ -747,7 +749,7 @@ node_free (void *p)
n->parent = NULL; n->parent = NULL;
} }
if (n->ino || n->node_lookups > 0) if ((n->ino && n->ino != &dummy_ino) || n->node_lookups > 0)
return; return;
if (n->children) if (n->children)
@ -1082,8 +1084,6 @@ node_set_name (struct ovl_node *node, char *name)
node->name_hash = hash_string (name, SIZE_MAX); node->name_hash = hash_string (name, SIZE_MAX);
} }
static struct ovl_ino dummy_ino;
static struct ovl_node * static struct ovl_node *
make_whiteout_node (const char *path, const char *name) make_whiteout_node (const char *path, const char *name)
{ {