forked from Imagelibrary/rtems
2009-11-23 Joel Sherrill <joel.sherrill@oarcorp.com>
* libmisc/shell/shell.c: Always duplicate the environment passed to us because we will delete it when the shell exits. If we do not duplicate it, we could end up freeing memory which was not allocated from the heap or double freeing it.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2009-11-23 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* libmisc/shell/shell.c: Always duplicate the environment passed to us
|
||||
because we will delete it when the shell exits. If we do not
|
||||
duplicate it, we could end up freeing memory which was not allocated
|
||||
from the heap or double freeing it.
|
||||
|
||||
2009-11-23 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* libmisc/shell/login_prompt.c: Properly process EOF and do not depend
|
||||
|
||||
@@ -62,16 +62,20 @@ rtems_shell_env_t *rtems_current_shell_env = &rtems_global_shell_env;
|
||||
* Initialize the shell user/process environment information
|
||||
*/
|
||||
rtems_shell_env_t *rtems_shell_init_env(
|
||||
rtems_shell_env_t *shell_env
|
||||
rtems_shell_env_t *shell_env_p
|
||||
)
|
||||
{
|
||||
if ( !shell_env ) {
|
||||
shell_env = malloc(sizeof(rtems_shell_env_t));
|
||||
if ( !shell_env )
|
||||
return NULL;
|
||||
rtems_shell_env_t *shell_env;
|
||||
|
||||
shell_env = malloc(sizeof(rtems_shell_env_t));
|
||||
if ( !shell_env )
|
||||
return NULL;
|
||||
if ( !shell_env_p ) {
|
||||
*shell_env = rtems_global_shell_env;
|
||||
shell_env->taskname = NULL;
|
||||
} else {
|
||||
*shell_env = *shell_env_p;
|
||||
}
|
||||
shell_env->taskname = NULL;
|
||||
|
||||
return shell_env;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user