remove memory leak
This commit is contained in:
parent
93d9540785
commit
0a29c633ad
1 changed files with 7 additions and 0 deletions
|
@ -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++;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue