xwayland: Close fd opened for lockfile on error path
authorRob Bradford <rob@linux.intel.com>
Wed, 5 Dec 2012 18:47:07 +0000 (18:47 +0000)
committerKristian Høgsberg <krh@bitplanet.net>
Fri, 7 Dec 2012 03:32:25 +0000 (22:32 -0500)
src/xwayland/launcher.c

index 59154a3..ddd9640 100644 (file)
@@ -247,6 +247,9 @@ create_lockfile(int display, char *lockfile, size_t lsize)
                if (fd < 0 || read(fd, pid, 11) != 11) {
                        weston_log("can't read lock file %s: %s\n",
                                lockfile, strerror(errno));
+                       if (fd >= 0)
+                               close (fd);
+
                        errno = EEXIST;
                        return -1;
                }