Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in mlt_alloc and suggested fix #99

Closed
jaffa4 opened this issue Feb 28, 2016 · 2 comments
Closed

bug in mlt_alloc and suggested fix #99

jaffa4 opened this issue Feb 28, 2016 · 2 comments

Comments

@jaffa4
Copy link

jaffa4 commented Feb 28, 2016

Hi,

While browsing your code I found some code that may cause problem under some circumstance.
Location:
mlt_pool.c
static void *pool_fetch( mlt_pool self

This seems to be wrong:mlt_release release = mlt_alloc( self->size )
It should be mlt_release release = mlt_alloc( self->size + sizeof( struct mlt_release_s )) ;

Reason? the caller expects to get size but it fact, the caller gets size- sizeof( struct mlt_release_s );
See this line: ptr = ( char * )release + sizeof( struct mlt_release_s );
Allocated size is reduced by mit_release_s.....

J.

@ddennedy
Copy link
Member

I understand your concern, but I think your analysis was incomplete. The main caller entry point is mlt_pool_alloc(), which includes this:
size += sizeof( struct mlt_release_s );
A size request that is near or equal to a power of two will be pushed into a pool based on the next higher order power of two and not receive a memory block size less than requested. If you still believe there is a problem, please submit a test case and patch.

@jaffa4
Copy link
Author

jaffa4 commented Feb 28, 2016

ok, no problem then. just size += sizeof( struct mlt_release_s ); was not located where I expected to be.

@jaffa4 jaffa4 closed this as completed Feb 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants