ref: f31c40086ef4e4c3aa0f399831a6c2388474bf32
parent: 7f009975e963b01857c27825c1b47bb32be03fa1
parent: 4d3c3be6ba744614bf7035eb87bd4c76a1fb92c4
author: John Koleszar <jkoleszar@google.com>
date: Mon Jul 16 12:05:20 EDT 2012
Merge "examples: fix memory leak"
--- a/examples/encoder_tmpl.txt
+++ b/examples/encoder_tmpl.txt
@@ -68,6 +68,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DESTROY
+vpx_img_free(&raw);
if(vpx_codec_destroy(&codec))
die_codec(&codec, "Failed to destroy codec");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DESTROY
--- a/examples/twopass_encoder.txt
+++ b/examples/twopass_encoder.txt
@@ -71,5 +71,17 @@
It's sometimes helpful to see when each pass completes.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TWOPASS_LOOP_END
printf("Pass %d complete.\n", pass+1);
+ if(vpx_codec_destroy(&codec))
+ die_codec(&codec, "Failed to destroy codec");
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TWOPASS_LOOP_END
+
+
+Clean-up
+-----------------------------
+Destruction of the encoder instance must be done on each pass. The
+raw image should be destroyed at the end as usual.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DESTROY
+vpx_img_free(&raw);
+free(stats.buf);
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DESTROY
--
⑨