diff options
Diffstat (limited to 'nuttx/arch/z16/src/common/up_usestack.c')
-rw-r--r-- | nuttx/arch/z16/src/common/up_usestack.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/nuttx/arch/z16/src/common/up_usestack.c b/nuttx/arch/z16/src/common/up_usestack.c index 6396ce9c2..7b5effc45 100644 --- a/nuttx/arch/z16/src/common/up_usestack.c +++ b/nuttx/arch/z16/src/common/up_usestack.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/z16/common/up_usestack.c * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -94,12 +94,16 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size) size_t top_of_stack; size_t size_of_stack; + /* Is there already a stack allocated? */ + if (tcb->stack_alloc_ptr) { - sched_ufree(tcb->stack_alloc_ptr); + /* Yes.. Release the old stack allocation */ + + up_release_stack(tcb, tcb->flags & TCB_FLAG_TTYPE_MASK); } - /* Save the stack allocation */ + /* Save the new stack allocation */ tcb->stack_alloc_ptr = stack; |