* Fixed CID 1750: the team args could be leaked in exec_team() on error.
* Also fixed a leak of the same object in team_create_thread_start() I spotted while looking into it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38227 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008-2010, Ingo Weinhold, [email protected].
|
* Copyright 2008-2010, Ingo Weinhold, [email protected].
|
||||||
* Copyright 2002-2009, Axel Dörfler, [email protected].
|
* Copyright 2002-2010, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||||
@@ -1094,6 +1094,7 @@ team_create_thread_start(void* args)
|
|||||||
|| user_memcpy(userArgs, teamArgs->flat_args,
|
|| user_memcpy(userArgs, teamArgs->flat_args,
|
||||||
teamArgs->flat_args_size) < B_OK) {
|
teamArgs->flat_args_size) < B_OK) {
|
||||||
// the team deletion process will clean this mess
|
// the team deletion process will clean this mess
|
||||||
|
free_team_arg(teamArgs);
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1219,7 +1220,6 @@ load_image_internal(char**& _flatArgs, size_t flatArgsSize, int32 argCount,
|
|||||||
|
|
||||||
status = create_team_arg(&teamArgs, path, flatArgs, flatArgsSize, argCount,
|
status = create_team_arg(&teamArgs, path, flatArgs, flatArgsSize, argCount,
|
||||||
envCount, errorPort, errorToken);
|
envCount, errorPort, errorToken);
|
||||||
|
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
goto err1;
|
goto err1;
|
||||||
|
|
||||||
@@ -1403,14 +1403,13 @@ exec_team(const char* path, char**& _flatArgs, size_t flatArgsSize,
|
|||||||
|
|
||||||
status = create_team_arg(&teamArgs, path, flatArgs, flatArgsSize, argCount,
|
status = create_team_arg(&teamArgs, path, flatArgs, flatArgsSize, argCount,
|
||||||
envCount, -1, 0);
|
envCount, -1, 0);
|
||||||
|
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
_flatArgs = NULL;
|
_flatArgs = NULL;
|
||||||
// args are owned by the team_arg structure now
|
// args are owned by the team_arg structure now
|
||||||
|
|
||||||
// ToDo: remove team resources if there are any left
|
// TODO: remove team resources if there are any left
|
||||||
// thread_atkernel_exit() might not be called at all
|
// thread_atkernel_exit() might not be called at all
|
||||||
|
|
||||||
thread_reset_for_exec();
|
thread_reset_for_exec();
|
||||||
@@ -1431,6 +1430,7 @@ exec_team(const char* path, char**& _flatArgs, size_t flatArgsSize,
|
|||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
// creating the user data failed -- we're toast
|
// creating the user data failed -- we're toast
|
||||||
// TODO: We should better keep the old user area in the first place.
|
// TODO: We should better keep the old user area in the first place.
|
||||||
|
free_team_arg(teamArgs);
|
||||||
exit_thread(status);
|
exit_thread(status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user