shithub: libvpx

Download patch

ref: fb4f013f27e3c5304a12f9cc2a863e093ceb3cc2
parent: f563d975c6d0b1b48f8dc1497cfc895ab523c312
author: angiebird <[email protected]>
date: Tue Nov 19 07:58:05 EST 2019

Fix a bug in free_encoder()

Move vpx_free(buffer_pool) after vp9_remove_compressor()

buffer_pool needs to be free after cpi because buffer_pool
contains allocated buffers that will be free in
vp9_remove_compressor()

Change-Id: I8bcedae2858cfe132bde110c8f3f6b55dcbe3f36

--- a/vp9/simple_encode.cc
+++ b/vp9/simple_encode.cc
@@ -64,8 +64,11 @@
 }
 
 static void free_encoder(VP9_COMP *cpi) {
-  vpx_free(cpi->common.buffer_pool);
+  BufferPool *buffer_pool = cpi->common.buffer_pool;
   vp9_remove_compressor(cpi);
+  // buffer_pool needs to be free after cpi because buffer_pool contains
+  // allocated buffers that will be free in vp9_remove_compressor()
+  vpx_free(buffer_pool);
 }
 
 static INLINE vpx_rational_t make_vpx_rational(int num, int den) {