mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 02:24:07 +00:00
Fixe memory leak
This commit is contained in:
parent
fa116de619
commit
0de567bfa4
|
@ -348,6 +348,8 @@ 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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue