Skip to content

Commit

Permalink
Sereal::Path: stop leaking stack in srl_iterator.c
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Kruglov committed Feb 19, 2017
1 parent 26c4e6d commit b5460b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Perl/Path/Iterator/srl_iterator.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ srl_deinit_iterator(pTHX_ srl_iterator_t *iter)

if (iter->document)
SvREFCNT_dec(iter->document);

srl_stack_deinit(aTHX_ &iter->stack);
}

void
Expand Down
4 changes: 2 additions & 2 deletions Perl/shared/srl_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ srl_stack_grow(pTHX_ srl_stack_t *stack)

/* Free stack arrfer (not not the stack struct */
SRL_STATIC_INLINE void
srl_stack_destroy(pTHX_ srl_stack_t *stack)
srl_stack_deinit(pTHX_ srl_stack_t *stack)
{
if (stack == NULL) return;
if (stack == NULL || stack->begin == NULL) return;
Safefree(stack->begin);
}

Expand Down

0 comments on commit b5460b1

Please sign in to comment.