[x264-devel] [PATCH] improve malloc checks to allow graceful exit on malloc failures

Steven Walters kemuri9 at gmail.com
Sat Jul 25 20:13:52 CEST 2009


Time to revive this from the dead with a new patch.
Dark Shikari had started on this and then got tired of it, so handed
it back to me.

either way, summary of changes are
1. check all memory allocations via CHECKED_MALLOC or checking for == NULL
2. due to the above occurring in a threaded function, add a new
variable to x264_t to keep track of the exit value
- IMO easier and safer than mallocing memory to pass to pthread_exit
to be then retrieved at pthread_join to then be freed.
3. check for initialization failures related to threading
4. remove x264_realloc; it's broken in various ways and only used in a
single location

I did have to change some things related to BeOS specifics on threading,
but I do not have a BeOS system available to confirm them as working though.

This covers all cases i could find/think of to prevent seg faults occurring.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x264_graceful_exit.diff
Type: application/octet-stream
Size: 44230 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20090725/939b10c9/attachment-0001.obj>


More information about the x264-devel mailing list