Commit 3688076d authored by John Koleszar's avatar John Koleszar
Browse files

dixie: fix memory leaks

Implemented the decoder shutdown call to deallocate buffers when the
codec is destroyed.

Change-Id: I6cd62f40f34e0db91fb7eb8cb673f5d9726fe192
parent 52a1b7df
No related merge requests found
Showing with 62 additions and 0 deletions
...@@ -525,3 +525,12 @@ vp8_dixie_decode_frame(struct vp8_decoder_ctx *ctx, ...@@ -525,3 +525,12 @@ vp8_dixie_decode_frame(struct vp8_decoder_ctx *ctx,
return ctx_->error.error_code; return ctx_->error.error_code;
} }
void
vp8_dixie_decode_destroy(struct vp8_decoder_ctx *ctx)
{
vp8_dixie_predict_destroy(ctx);
vp8_dixie_tokens_destroy(ctx);
vp8_dixie_modemv_destroy(ctx);
}
...@@ -315,6 +315,10 @@ void ...@@ -315,6 +315,10 @@ void
vp8_dixie_decode_init(struct vp8_decoder_ctx *ctx); vp8_dixie_decode_init(struct vp8_decoder_ctx *ctx);
void
vp8_dixie_decode_destroy(struct vp8_decoder_ctx *ctx);
vpx_codec_err_t vpx_codec_err_t
vp8_parse_frame_header(const unsigned char *data, vp8_parse_frame_header(const unsigned char *data,
unsigned int sz, unsigned int sz,
......
...@@ -666,3 +666,13 @@ vp8_dixie_modemv_init(struct vp8_decoder_ctx *ctx) ...@@ -666,3 +666,13 @@ vp8_dixie_modemv_init(struct vp8_decoder_ctx *ctx)
ctx->mb_info_rows = ctx->mb_info_rows_storage + 1; ctx->mb_info_rows = ctx->mb_info_rows_storage + 1;
} }
void
vp8_dixie_modemv_destroy(struct vp8_decoder_ctx *ctx)
{
free(ctx->mb_info_storage);
ctx->mb_info_storage = NULL;
free(ctx->mb_info_rows_storage);
ctx->mb_info_rows_storage = NULL;
}
...@@ -14,6 +14,10 @@ void ...@@ -14,6 +14,10 @@ void
vp8_dixie_modemv_init(struct vp8_decoder_ctx *ctx); vp8_dixie_modemv_init(struct vp8_decoder_ctx *ctx);
void
vp8_dixie_modemv_destroy(struct vp8_decoder_ctx *ctx);
void void
vp8_dixie_modemv_process_row(struct vp8_decoder_ctx *ctx, vp8_dixie_modemv_process_row(struct vp8_decoder_ctx *ctx,
struct bool_decoder *bool, struct bool_decoder *bool,
......
...@@ -1836,6 +1836,20 @@ vp8_dixie_predict_init(struct vp8_decoder_ctx *ctx) ...@@ -1836,6 +1836,20 @@ vp8_dixie_predict_init(struct vp8_decoder_ctx *ctx)
} }
void
vp8_dixie_predict_destroy(struct vp8_decoder_ctx *ctx)
{
int i;
for (i = 0; i < NUM_REF_FRAMES; i++)
{
vpx_img_free(&ctx->frame_strg[i].img);
ctx->frame_strg[i].ref_cnt = 0;
ctx->ref_frames[i] = NULL;
}
}
void void
vp8_dixie_predict_process_row(struct vp8_decoder_ctx *ctx, vp8_dixie_predict_process_row(struct vp8_decoder_ctx *ctx,
unsigned int row, unsigned int row,
......
...@@ -14,6 +14,10 @@ void ...@@ -14,6 +14,10 @@ void
vp8_dixie_predict_init(struct vp8_decoder_ctx *ctx); vp8_dixie_predict_init(struct vp8_decoder_ctx *ctx);
void
vp8_dixie_predict_destroy(struct vp8_decoder_ctx *ctx);
void void
vp8_dixie_predict_process_row(struct vp8_decoder_ctx *ctx, vp8_dixie_predict_process_row(struct vp8_decoder_ctx *ctx,
unsigned int row, unsigned int row,
......
...@@ -479,3 +479,15 @@ vp8_dixie_tokens_init(struct vp8_decoder_ctx *ctx) ...@@ -479,3 +479,15 @@ vp8_dixie_tokens_init(struct vp8_decoder_ctx *ctx)
vpx_internal_error(&ctx->error, VPX_CODEC_MEM_ERROR, NULL); vpx_internal_error(&ctx->error, VPX_CODEC_MEM_ERROR, NULL);
} }
} }
void
vp8_dixie_tokens_destroy(struct vp8_decoder_ctx *ctx)
{
int i;
for (i = 0; i < MAX_PARTITIONS; i++)
free(ctx->tokens[i].coeffs);
free(ctx->above_token_entropy_ctx);
}
...@@ -14,6 +14,10 @@ void ...@@ -14,6 +14,10 @@ void
vp8_dixie_tokens_init(struct vp8_decoder_ctx *ctx); vp8_dixie_tokens_init(struct vp8_decoder_ctx *ctx);
void
vp8_dixie_tokens_destroy(struct vp8_decoder_ctx *ctx);
void void
vp8_dixie_tokens_process_row(struct vp8_decoder_ctx *ctx, vp8_dixie_tokens_process_row(struct vp8_decoder_ctx *ctx,
unsigned int partition, unsigned int partition,
......
...@@ -82,6 +82,7 @@ static vpx_codec_err_t vp8_init(vpx_codec_ctx_t *ctx) ...@@ -82,6 +82,7 @@ static vpx_codec_err_t vp8_init(vpx_codec_ctx_t *ctx)
static vpx_codec_err_t vp8_destroy(vpx_codec_alg_priv_t *ctx) static vpx_codec_err_t vp8_destroy(vpx_codec_alg_priv_t *ctx)
{ {
vp8_dixie_decode_destroy(&ctx->decoder_ctx);
vpx_free(ctx->base.alg_priv); vpx_free(ctx->base.alg_priv);
return VPX_CODEC_OK; return VPX_CODEC_OK;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment