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) {
fprintf(stderr, "can't parse lock file %s\n",
lockfile);
close(fd);
errno = EEXIST;
return -1;
}
@@ -1655,6 +1656,7 @@ create_lockfile(int display, char *lockfile, size_t lsize)
"unlinking stale lock file %s\n", lockfile);
unlink(lockfile);
errno = EAGAIN;
close(fd);
return -1;
}