remove memory leak

This commit is contained in:
Marian Ohligs 2012-09-12 15:42:07 +02:00
parent 93d9540785
commit 0a29c633ad

View file

@ -352,6 +352,13 @@ static int sys_dup(int fd)
if (BUILTIN_EXPECT((new_fd >= NR_OPEN) || (fd < 0), 0))
return new_fd; /* in this case fd = errno */
/*
* free the memory which was allocated in get_fildes()
* cause will link it to another existing memory space
*/
kfree(curr_task->fildes_table[new_fd], sizeof(fildes_t));
/* and link it to another existing memory space */
curr_task->fildes_table[new_fd] = curr_task->fildes_table[fd];
curr_task->fildes_table[fd]->count++;