From: James Berry Date: Thu, 23 Dec 2010 19:47:56 +0000 (-0500) Subject: vpxenc stats_close() memleak fix X-Git-Tag: v0.9.6~131 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=74e8446e586380597441094bb9b4d82933fb305d;p=libvpx vpxenc stats_close() memleak fix stats_close() was not freeing memory for single pass runs. It now takes in arg_passes to determine when it should free memory. Change-Id: I6623b7e30b76f9bf2e16008490f9b20484d03f31 --- diff --git a/vpxenc.c b/vpxenc.c index 5e4fe3f0f..cb911bec0 100755 --- a/vpxenc.c +++ b/vpxenc.c @@ -186,11 +186,11 @@ int stats_open_mem(stats_io_t *stats, int pass) } -void stats_close(stats_io_t *stats) +void stats_close(stats_io_t *stats, int last_pass) { if (stats->file) { - if (stats->pass == 1) + if (stats->pass == last_pass) { #if 0 #elif USE_POSIX_MMAP @@ -205,7 +205,7 @@ void stats_close(stats_io_t *stats) } else { - if (stats->pass == 1) + if (stats->pass == last_pass) free(stats->buf.buf); } } @@ -1692,7 +1692,7 @@ int main(int argc, const char **argv_) } fclose(outfile); - stats_close(&stats); + stats_close(&stats, arg_passes-1); fprintf(stderr, "\n"); if (one_pass_only)