Author: pjd
Date: Wed Sep  3 14:44:23 2014
New Revision: 271026
URL: http://svnweb.freebsd.org/changeset/base/271026

Log:
  Fix descriptors leak in case of nvlist_xunpack() failure.
  
  Submitted by: Mariusz Zaborski <osho...@freebsd.org>

Modified:
  head/lib/libnv/nvlist.c

Modified: head/lib/libnv/nvlist.c
==============================================================================
--- head/lib/libnv/nvlist.c     Wed Sep  3 14:16:50 2014        (r271025)
+++ head/lib/libnv/nvlist.c     Wed Sep  3 14:44:23 2014        (r271026)
@@ -760,8 +760,11 @@ nvlist_recv(int sock)
        }
 
        nvl = nvlist_xunpack(buf, size, fds, nfds);
-       if (nvl == NULL)
+       if (nvl == NULL) {
+               for (i = 0; i < nfds; i++)
+                       close(fds[i]);
                goto out;
+       }
 
        ret = nvl;
 out:
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to