Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Sep 2014 14:44:24 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r271026 - head/lib/libnv
Message-ID:  <201409031444.s83EiOvS070847@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409031444.s83EiOvS070847>