]> granicus.if.org Git - handbrake/commitdiff
fifo: when HB_BUFFER_DEBUG is set, memset buffers to 0
authorJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 23 Mar 2016 17:24:25 +0000 (11:24 -0600)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 23 Mar 2016 17:24:25 +0000 (11:24 -0600)
libhb/fifo.c

index 62a34b8b325474a08c88f8940f9c90748aba0a7f..508dfba1d758d69d3697871c16a9f9b3469e07fd 100644 (file)
@@ -430,6 +430,9 @@ hb_buffer_t * hb_buffer_init_internal( int size , int needsMapped )
             free( b );
             return NULL;
         }
+#if defined(HB_BUFFER_DEBUG)
+        memset(b->data, 0, b->size);
+#endif
         hb_lock(buffers.lock);
         buffers.allocated += b->alloc;
         hb_unlock(buffers.lock);
@@ -465,6 +468,9 @@ void hb_buffer_realloc( hb_buffer_t * b, int size )
         size = size_to_pool( size )->buffer_size;
         b->data  = realloc( b->data, size );
         b->alloc = size;
+#if defined(HB_BUFFER_DEBUG)
+        memset(b->data, 0, b->size);
+#endif
 
         hb_lock(buffers.lock);
         buffers.allocated += size - orig;