Plug a memory leak in dup2 when both old and new fd have ioctl caps.

Reviewed by:	pjd
MFC after:	3 days
This commit is contained in:
Mateusz Guzik 2014-01-03 16:36:55 +00:00
parent 0918d4b21f
commit 231a0fe857

View File

@ -878,6 +878,7 @@ do_dup(struct thread *td, int flags, int old, int new,
/*
* Duplicate the source descriptor.
*/
filecaps_free(&newfde->fde_caps);
*newfde = *oldfde;
filecaps_copy(&oldfde->fde_caps, &newfde->fde_caps);
if ((flags & DUP_CLOEXEC) != 0)