Skip to content

Commit

Permalink
Proper reference counting in tag builder
Browse files Browse the repository at this point in the history
  • Loading branch information
PJK committed Apr 26, 2015
1 parent 065ad4c commit dac7570
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/cbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ void cbor_decref(cbor_item_t ** item)
case CBOR_TYPE_MAP:
case CBOR_TYPE_TAG:
{
cbor_decref(&(*item)->metadata.tag_metadata.tagged_item);
_CBOR_FREE((*item)->data);
break;
}
Expand Down
1 change: 1 addition & 0 deletions src/cbor_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ void _cbor_builder_append(cbor_item_t * item, struct _cbor_decoder_context * ctx
{
assert(ctx->stack->top->subitems == 1);
cbor_tag_set_item(ctx->stack->top->item, item);
cbor_decref(&item); /* Give up on our reference */
cbor_item_t *item = ctx->stack->top->item;
_cbor_stack_pop(ctx->stack);
_cbor_builder_append(item, ctx);
Expand Down

0 comments on commit dac7570

Please sign in to comment.