summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'client.c')
-rw-r--r--client.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/client.c b/client.c
index 1458963c..4cf73fb9 100644
--- a/client.c
+++ b/client.c
@@ -118,10 +118,15 @@ retry:
close(fd);
xasprintf(&lockfile, "%s.lock", path);
- if ((lockfd = client_get_lock(lockfile)) == -1)
+ if ((lockfd = client_get_lock(lockfile)) == -1) {
+ free(lockfile);
goto retry;
- if (unlink(path) != 0 && errno != ENOENT)
+ }
+ if (unlink(path) != 0 && errno != ENOENT) {
+ free(lockfile);
+ close(lockfd);
return (-1);
+ }
fd = server_start(lockfd, lockfile);
free(lockfile);
close(lockfd);