From 9ab77f59d2e842fc527ab1f01e2b893786b63a95 Mon Sep 17 00:00:00 2001 From: feiniks <36756310+feiniks@users.noreply.github.com> Date: Wed, 7 Jun 2023 10:00:31 +0800 Subject: [PATCH] Fix free path twice (#2680) Co-authored-by: heran yang --- daemon/vc-utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/vc-utils.c b/daemon/vc-utils.c index 29a8cee4..3eb0177e 100644 --- a/daemon/vc-utils.c +++ b/daemon/vc-utils.c @@ -676,8 +676,6 @@ do_check_file_locked (const char *path, const char *worktree, gboolean locked_on ret = TRUE; goto out; } - g_free (tmp_name); - g_free (fullpath); /* Sometimes the first two characters are replaced by ~$. */ @@ -685,6 +683,8 @@ do_check_file_locked (const char *path, const char *worktree, gboolean locked_on goto out; char *ptr = g_utf8_find_next_char(g_utf8_find_next_char (file_name, NULL), NULL); + g_free (tmp_name); + g_free (fullpath); tmp_name = g_strconcat ("~$", ptr, NULL); fullpath = g_build_path ("/", worktree, dir_name, tmp_name, NULL); if (g_file_test (fullpath, G_FILE_TEST_IS_REGULAR)) {