Fix free path twice (#2680)

Co-authored-by: heran yang <heran.yang@seafile.com>
This commit is contained in:
feiniks 2023-06-07 10:00:31 +08:00 committed by GitHub
parent f3b2eb7372
commit 9ab77f59d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)) {