commit 3e0bd533db102c86565665d7b997bff3de7c8796
parent e8d20a8e4b1991ae2490cb8b5c6ee34316c24d67
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 14 Jan 2020 11:01:32 +0100
tweaks: free two strings as soon as they are no longer needed
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -308,6 +308,8 @@ int do_lockfile(const char *filename, bool ask_the_user)
snprintf(lockfilename, locknamesize, "%s/%s%s%s", dirname(namecopy),
locking_prefix, basename(secondcopy), locking_suffix);
+ free(secondcopy);
+ free(namecopy);
if (!ask_the_user && stat(lockfilename, &fileinfo) != -1)
warn_and_shortly_pause(_("Someone else is also editing this file"));
@@ -385,8 +387,6 @@ int do_lockfile(const char *filename, bool ask_the_user)
retval = write_lockfile(lockfilename, filename, FALSE);
free_the_name:
- free(namecopy);
- free(secondcopy);
if (retval < 1)
free(lockfilename);