Probably memory leaks #237

Closed
opened 2026-01-29 16:38:38 +00:00 by claunia · 2 comments
Owner

Originally created by @maxkoryukov on GitHub (Jan 12, 2017).

I think, there are memory leaks here:

6c733e96c9/src/lib_ccx/dvb_subtitle_decoder.c (L1657-1658)

memcpy on line 1657 causes overwrites of pointers to the allocated memory:

  1. enc_ctx->prev->buffer
  2. enc_ctx->prev->subline
  3. enc_ctx->prev->sbs_buffer

This memory is allocated in the function ccx_encoders_common.c::init_encoder

Originally created by @maxkoryukov on GitHub (Jan 12, 2017). I think, there are memory leaks here: https://github.com/CCExtractor/ccextractor/blob/6c733e96c9aaeb0a76c935da7e11d362afca36f4/src/lib_ccx/dvb_subtitle_decoder.c#L1657-1658 `memcpy` on line 1657 causes overwrites of pointers to the allocated memory: 1. `enc_ctx->prev->buffer` 2. `enc_ctx->prev->subline` 3. `enc_ctx->prev->sbs_buffer` This memory is allocated in the function `ccx_encoders_common.c::init_encoder`
Author
Owner

@cfsmp3 commented on GitHub (Jan 12, 2017):

Agreed... we need to have one (or several) clone_contexts functions, such as clone_encoder_context() that creates a copy of allocated memory, etc. With memcpy() we end up with two contexts pointing to the same thing which is going to be a problem, too.

@AlexBratosin2001 this would be yours to look at when possible.

@cfsmp3 commented on GitHub (Jan 12, 2017): Agreed... we need to have one (or several) clone_contexts functions, such as clone_encoder_context() that creates a copy of allocated memory, etc. With memcpy() we end up with two contexts pointing to the same thing which is going to be a problem, too. @AlexBratosin2001 this would be yours to look at when possible.
Author
Owner

@maxkoryukov commented on GitHub (Jan 13, 2017):

in the mentioned commit (d73b1d11438ec372fb3143edea86926b8cd35f96) I've fixed only the part, related to Sentence Buffer (split to sentences). So, label fix should be replaced with see, because it is just a workaround for SBS and this bug

@maxkoryukov commented on GitHub (Jan 13, 2017): in the mentioned commit (d73b1d11438ec372fb3143edea86926b8cd35f96) I've fixed only the part, related to Sentence Buffer (split to sentences). So, label **fix** should be replaced with **see**, because it is just a workaround for SBS and this bug
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#237