[Pommed-commits] [SCM] pommed - hotkeys handler for Apple laptops branch, master, updated. 1.25-7-g3dac0d9

Julien BLACHE jb at jblache.org
Mon Mar 9 22:02:47 UTC 2009


The following commit has been merged in the master branch:
commit 3dac0d910a769c20dc39cc1682481c081f19415d
Author: Julien BLACHE <jb at jblache.org>
Date:   Mon Mar 9 23:01:07 2009 +0100

    Fix /dev/mem fd leakage on mmap() failure
    
    fd for /dev/mem was not closed on mmap() failure, leading to leakage of open
    /dev/mem file descriptors.

diff --git a/pommed/mactel/gma950_backlight.c b/pommed/mactel/gma950_backlight.c
index fb50fb6..6af2a86 100644
--- a/pommed/mactel/gma950_backlight.c
+++ b/pommed/mactel/gma950_backlight.c
@@ -140,6 +140,10 @@ gma950_backlight_map(void)
   if (memory == MAP_FAILED)
     {
       logmsg(LOG_ERR, "mmap failed: %s", strerror(errno));
+
+      close(fd);
+      fd = -1;
+
       return -1;
     }
 
diff --git a/pommed/mactel/x1600_backlight.c b/pommed/mactel/x1600_backlight.c
index 13cc231..735cb3c 100644
--- a/pommed/mactel/x1600_backlight.c
+++ b/pommed/mactel/x1600_backlight.c
@@ -98,6 +98,10 @@ x1600_backlight_map(void)
   if (fd < 0)
     {
       logmsg(LOG_WARNING, "Cannot open /dev/mem: %s", strerror(errno));
+
+      close(fd);
+      fd = -1;
+
       return -1;
     }
 

-- 
pommed - hotkeys handler for Apple laptops



More information about the Pommed-commits mailing list