Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Sep 2010 06:51:02 +0300
From:      Mikolaj Golub <to.my.trociny@gmail.com>
To:        freebsd-fs@freebsd.org
Subject:   hastd: memory leaks if fork() fails
Message-ID:  <86mxr7x0ih.fsf@kopusha.home.net>

next in thread | raw e-mail | index | archive | help
--=-=-=

Hi,

Although it is rather unlikely situation but anyway :-)

If fork() fails in hook_execv() hastd leaks some bytes referred by hp. See the
attached patch.

-- 
Mikolaj Golub


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=hooks.c.patch

Index: sbin/hastd/hooks.c
===================================================================
--- sbin/hastd/hooks.c	(revision 213027)
+++ sbin/hastd/hooks.c	(working copy)
@@ -388,6 +388,7 @@ hook_execv(const char *path, va_list ap)
 	switch (pid) {
 	case -1:	/* Error. */
 		pjdlog_errno(LOG_ERR, "Unable to fork to execute %s", path);
+		hook_free(hp);
 		return;
 	case 0:		/* Child. */
 		descriptors();

--=-=-=--



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