]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Hurd: fix sendmsg memory leak in error paths
authorEmilio Pozuelo Monfort <pochu27@gmail.com>
Wed, 21 Jul 2010 02:19:34 +0000 (19:19 -0700)
committerRoland McGrath <roland@redhat.com>
Wed, 21 Jul 2010 02:19:34 +0000 (19:19 -0700)
ChangeLog
sysdeps/mach/hurd/sendmsg.c

index de7f38f8aacd8cd9784bfc4736c045cac167f125..fa670c5d54d8df6118c53c5794123374a08eaaba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@
        ld.so.cache was broken.  With it, there is no way to disable dsocaps
        like LD_HWCAP_MASK can disable hwcaps.
 
+2010-06-02  Emilio Pozuelo Monfort  <pochu27@gmail.com>
+
+       * sysdeps/mach/hurd/sendmsg.c (__libc_sendmsg): Fix memory leaks.
+
 2010-07-16  Ulrich Drepper  <drepper@redhat.com>
 
        * sysdeps/x86_64/multiarch/strstr.c: Rewrite to avoid indirect function
index a9d1c8c1d413c31222b7cec82ff9345d84fbdf32..118fd59a5b34f8d0e0b1776aecf1848de50715eb 100644 (file)
@@ -109,14 +109,22 @@ __libc_sendmsg (int fd, const struct msghdr *message, int flags)
             and talk to it with the ifsock protocol.  */
          file_t file = __file_name_lookup (addr->sun_path, 0, 0);
          if (file == MACH_PORT_NULL)
-           return -1;
+           {
+             if (dealloc)
+               __vm_deallocate (__mach_task_self (), data.addr, len);
+             return -1;
+           }
          err = __ifsock_getsockaddr (file, &aport);
          __mach_port_deallocate (__mach_task_self (), file);
          if (err == MIG_BAD_ID || err == EOPNOTSUPP)
            /* The file did not grok the ifsock protocol.  */
            err = ENOTSOCK;
          if (err)
-           return __hurd_fail (err);
+           {
+             if (dealloc)
+               __vm_deallocate (__mach_task_self (), data.addr, len);
+             return __hurd_fail (err);
+           }
        }
       else
        err = EIEIO;