diff options
author | Vijay Pai <vpai@google.com> | 2016-02-04 12:40:41 -0800 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2016-02-04 12:40:41 -0800 |
commit | 07a6be99bd2ac039bfef797f05ce76b020645230 (patch) | |
tree | 92e14d8ee48df3beea51ad83e805e5f6736b6842 /src/core | |
parent | 3ad28d0f1ce2274dad4e28827b5bc5456f9e1fc6 (diff) |
Stop upsetting valgrind with uninitialized shorts
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/support/stack_lockfree.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/support/stack_lockfree.c b/src/core/support/stack_lockfree.c index cd0afddf9d..c18fb65ae6 100644 --- a/src/core/support/stack_lockfree.c +++ b/src/core/support/stack_lockfree.c @@ -99,6 +99,10 @@ gpr_stack_lockfree *gpr_stack_lockfree_create(size_t entries) { /* Point the head at reserved dummy entry */ stack->head.contents.index = INVALID_ENTRY_INDEX; +#ifdef GPR_ARCH_64 + stack->head.contents.pad = 0; +#endif + stack->head.contents.aba_ctr = 0; return stack; } @@ -115,6 +119,10 @@ int gpr_stack_lockfree_push(gpr_stack_lockfree *stack, int entry) { /* First fill in the entry's index and aba ctr for new head */ newhead.contents.index = (uint16_t)entry; +#ifdef GPR_ARCH_64 + newhead.contents.pad = 0; +#endif + /* Also post-increment the aba_ctr */ curent.atm = gpr_atm_no_barrier_load(&stack->entries[entry].atm); newhead.contents.aba_ctr = ++curent.contents.aba_ctr; |