if( b->data )
{
freed += b->alloc;
- free(b->data);
+ av_free(b->data);
}
free( b );
count++;
if (size)
{
-#if defined( SYS_DARWIN ) || defined( SYS_FREEBSD ) || defined ( __FreeBSD__ ) || defined( SYS_MINGW )
- b->data = malloc( b->alloc );
-#elif defined( SYS_CYGWIN )
- /* FIXME */
- b->data = malloc( b->alloc + 17 );
-#else
- b->data = memalign( 16, b->alloc );
-#endif
-
+ b->data = av_malloc(b->alloc);
if( !b->data )
{
hb_log( "out of memory" );
{
if ( size > b->alloc || b->data == NULL )
{
- uint32_t orig = b->data != NULL ? b->alloc : 0;
- hb_fifo_t *buffer_pool = size_to_pool(size);
+ uint8_t * tmp;
+ uint32_t orig = b->data != NULL ? b->alloc : 0;
+ hb_fifo_t * buffer_pool = size_to_pool(size);
+
if (buffer_pool != NULL)
{
size = buffer_pool->buffer_size;
}
- b->data = realloc( b->data, size );
+ tmp = av_malloc(size);
+ if (tmp == NULL)
+ {
+ return;
+ }
+ memcpy(tmp, b->data, b->alloc);
+ av_free(b->data);
+ b->data = tmp;
b->alloc = size;
hb_lock(buffers.lock);
// free the buf
if( b->data )
{
- free(b->data);
+ av_free(b->data);
hb_lock(buffers.lock);
buffers.allocated -= b->alloc;
hb_unlock(buffers.lock);
{
return NULL;
}
-#if defined( SYS_DARWIN ) || defined( SYS_FREEBSD ) || defined ( __FreeBSD__ ) || defined( SYS_MINGW )
- image->data = malloc(size);
-#elif defined( SYS_CYGWIN )
- /* FIXME */
- image->data = malloc(size + 17);
-#else
- image->data = memalign(16, size);
-#endif
+ image->data = av_malloc(size);
if (image->data == NULL)
{
free(image);
{
hb_image_t *image = calloc(1, sizeof(hb_image_t));
-#if defined( SYS_DARWIN ) || defined( SYS_FREEBSD ) || defined ( __FreeBSD__ ) || defined( SYS_MINGW )
- image->data = malloc( buf->size );
-#elif defined( SYS_CYGWIN )
- /* FIXME */
- image->data = malloc( buf->size + 17 );
-#else
- image->data = memalign( 16, buf->size );
-#endif
+ image->data = av_malloc( buf->size );
if (image->data == NULL)
{
free(image);
hb_image_t * image = *_image;
if (image != NULL)
{
- free(image->data);
+ av_free(image->data);
free(image);
*_image = NULL;
}