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

Loren Merritt lorenm at u.washington.edu
Sun Jul 26 15:35:06 CEST 2009


On Sun, 26 Jul 2009, Steven Walters wrote:

> Ok, honestly i had a somewhat difficult time trying to come up with
> something to not create a malloc, and not add a variable to x264_t.
> then came the following idea a bit ago:

This doesn't have to be hard.

-static int x264_slices_write( ... )
+static void *x264_slices_write( ... )
  {
  ...
+return (void*)ret;
  }

  static int x264_encoder_frame_end( ... )
  {
  ...
-x264_pthread_join( h->thread_handle, NULL );
+void UNUSED *ret;
+x264_pthread_join( h->thread_handle, &ret );
+if( (intptr_t)ret )
+  return (intptr_t)ret;
  ...
  }

--Loren Merritt



More information about the x264-devel mailing list