xserver: Don't leak lockfile fd on error path
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user