diff options
author | James Zern <jzern@google.com> | 2013-12-13 19:03:08 -0800 |
---|---|---|
committer | James Zern <jzern@google.com> | 2013-12-13 19:06:21 -0800 |
commit | c5aaf923d80e9f71e0c93d7d99dc1e2f83d7acbf (patch) | |
tree | 311f4f26b8f39aac9e5728832f9ea7762ea6e2f6 /test/webm_video_source.h | |
parent | 64cf3987131bf7ad1b19b7eb10cd2ceb5b0b7a1f (diff) | |
download | libvpx-c5aaf923d80e9f71e0c93d7d99dc1e2f83d7acbf.tar libvpx-c5aaf923d80e9f71e0c93d7d99dc1e2f83d7acbf.tar.gz libvpx-c5aaf923d80e9f71e0c93d7d99dc1e2f83d7acbf.tar.bz2 libvpx-c5aaf923d80e9f71e0c93d7d99dc1e2f83d7acbf.zip |
webmdec/tests: fix leak when file isn't read to eof
the nestegg packet was only freed by subsequent reads
Change-Id: Ib687a13907861c7575830783e47a596d85169cf1
Diffstat (limited to 'test/webm_video_source.h')
-rw-r--r-- | test/webm_video_source.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/test/webm_video_source.h b/test/webm_video_source.h index 9fc854593..53b0ba2b4 100644 --- a/test/webm_video_source.h +++ b/test/webm_video_source.h @@ -90,8 +90,12 @@ class WebMVideoSource : public CompressedVideoSource { virtual ~WebMVideoSource() { if (input_file_) fclose(input_file_); - if (nestegg_ctx_) + if (nestegg_ctx_ != NULL) { + if (pkt_ != NULL) { + nestegg_free_packet(pkt_); + } nestegg_destroy(nestegg_ctx_); + } } virtual void Init() { @@ -136,8 +140,10 @@ class WebMVideoSource : public CompressedVideoSource { do { /* End of this packet, get another. */ - if (pkt_) + if (pkt_ != NULL) { nestegg_free_packet(pkt_); + pkt_ = NULL; + } int again = nestegg_read_packet(nestegg_ctx_, &pkt_); ASSERT_GE(again, 0) << "nestegg_read_packet failed"; |