Fixe memory leak

This commit is contained in:
mercat 2019-09-12 09:45:32 +03:00
parent fa116de619
commit 0de567bfa4
2 changed files with 7 additions and 9 deletions

View file

@ -348,7 +348,9 @@ int kvz_encoder_state_init(encoder_state_t * const child_state, encoder_state_t
if (!child_state->slice) child_state->slice = parent_state->slice;
if (!child_state->wfrow) child_state->wfrow = parent_state->wfrow;
}
// Intialization of the constraint structure
child_state->constraint = kvz_init_constraint(child_state->constraint, child_state->encoder_control);
kvz_bitstream_init(&child_state->stream);
// Set CABAC output bitstream
@ -706,7 +708,7 @@ void kvz_encoder_state_finalize(encoder_state_t * const state) {
FREE_POINTER(state->frame);
}
if (!state->parent) {
if (state->constraint) {
// End of the constraint structure
kvz_constraint_free(state);
}

View file

@ -1165,9 +1165,9 @@ static void encoder_state_init_children(encoder_state_t * const state) {
//Copy the constraint pointer
// TODO: Try to do it in the if (state->is_leaf)
if (state->parent != NULL) {
state->constraint = state->parent->constraint;
}
//if (state->parent != NULL) {
// state->constraint = state->parent->constraint;
//}
for (int i = 0; state->children[i].encoder_control; ++i) {
encoder_state_init_children(&state->children[i]);
@ -1342,10 +1342,6 @@ void kvz_encoder_prepare(encoder_state_t *state)
// The previous frame must be done before the next one is started.
assert(state->frame->done);
// Intialization of the constraint structure
state->constraint = kvz_init_constraint(state->constraint, encoder);
if (state->frame->num == -1) {
// We're at the first frame, so don't care about all this stuff.
state->frame->num = 0;