svn commit: r271026 - head/lib/libnv

Pawel Jakub Dawidek pjd at FreeBSD.org
Wed Sep 3 14:44:24 UTC 2014


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 <oshogbo at 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:


More information about the svn-src-head mailing list