From 52fd6215b0bdfc07c34729ab379948ac6742319a Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Tue, 7 Jun 2022 22:03:53 +0300 Subject: [PATCH] Ticket #4357: code clean up before 4.8.29 release. (vfs_s_open): minor optimization. Signed-off-by: Andrew Borodin --- lib/vfs/direntry.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/vfs/direntry.c b/lib/vfs/direntry.c index e39906e7b..16445125c 100644 --- a/lib/vfs/direntry.c +++ b/lib/vfs/direntry.c @@ -1327,15 +1327,12 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode) return NULL; dirname = g_path_get_dirname (q); - name = g_path_get_basename (q); dir = vfs_s_find_inode (path_element->class, super, dirname, LINK_FOLLOW, FL_DIR); + g_free (dirname); if (dir == NULL) - { - g_free (dirname); - g_free (name); return NULL; - } + name = g_path_get_basename (q); ent = vfs_s_generate_entry (path_element->class, name, dir, 0755); ino = ent->ino; vfs_s_insert_entry (path_element->class, dir, ent); @@ -1348,14 +1345,13 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode) ino->localname = vfs_path_free (tmp_vpath, FALSE); if (tmp_handle == -1) { - g_free (dirname); g_free (name); return NULL; } close (tmp_handle); } - g_free (dirname); + g_free (name); was_changed = TRUE; } -- 2.11.4.GIT