From 2b8dff330fdaceeb26f755d8c25f023909fe1bdc Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Mon, 29 Jun 2020 13:54:11 +0200 Subject: [PATCH] main: fix memory leak when creating a whiteout Closes: https://github.com/containers/fuse-overlayfs/issues/222 Signed-off-by: Giuseppe Scrivano --- main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index d961ef0..fbbf93b 100644 --- a/main.c +++ b/main.c @@ -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) { @@ -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) @@ -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) {