cvs commit: src/sys/geom/vinum geom_vinum_raid5.c

Pawel Jakub Dawidek pjd at FreeBSD.org
Tue Jun 22 15:17:31 PDT 2004


On Tue, Jun 22, 2004 at 02:54:31PM +0000, Lukas Ertl wrote:
+> le          2004-06-22 14:54:31 UTC
+> 
+>   FreeBSD src repository
+> 
+>   Modified files:
+>     sys/geom/vinum       geom_vinum_raid5.c 
+>   Log:
+>   Don't sleep in the g_down path.  More error checks to come.

Yeah, there are many potential memory leaks, many situations like this:

	ptr = malloc(...);
	if (ptr == NULL)
		return (ENOMEM);
	LIST_FOREACH(...) {
		ptr1 = malloc(...);
		if (ptr1 == NULL)
			return (ENOMEM);
		[...]
		ptr2 = malloc(...);
		if (ptr2 == NULL)
			return (ENOMEM);
	}

So if for example allocation of 'ptr2' fails, we leak 'ptr' and 'ptr1'.
Maybe you should just use kernel thread to do whole I/O handling to
avoid such complex scenarious?

-- 
Pawel Jakub Dawidek                       http://www.FreeBSD.org
pjd at FreeBSD.org                           http://garage.freebsd.pl
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20040623/7691a4c7/attachment.bin


More information about the cvs-src mailing list