xserver: Don't leak lockfile fd on error path

This commit is contained in:
Kristian Høgsberg
2012-04-09 22:13:17 -04:00
parent 31dd6b86c1
commit 2c76be7c1b
+2
View File
@@ -1645,6 +1645,7 @@ create_lockfile(int display, char *lockfile, size_t lsize)
if (end != pid + 10) { if (end != pid + 10) {
fprintf(stderr, "can't parse lock file %s\n", fprintf(stderr, "can't parse lock file %s\n",
lockfile); lockfile);
close(fd);
errno = EEXIST; errno = EEXIST;
return -1; return -1;
} }
@@ -1655,6 +1656,7 @@ create_lockfile(int display, char *lockfile, size_t lsize)
"unlinking stale lock file %s\n", lockfile); "unlinking stale lock file %s\n", lockfile);
unlink(lockfile); unlink(lockfile);
errno = EAGAIN; errno = EAGAIN;
close(fd);
return -1; return -1;
} }