]> granicus.if.org Git - libvpx/commitdiff
MinArfFreqTest: Don't leak video on failure.
authorAlex Converse <aconverse@google.com>
Thu, 21 Jul 2016 18:38:27 +0000 (11:38 -0700)
committerYaowu Xu <yaowu@google.com>
Tue, 26 Jul 2016 04:11:56 +0000 (04:11 +0000)
Change-Id: I250379f0ac8d4929c9032e7343290e2980fc2e77

test/vp9_arf_freq_test.cc

index ecbcf92b7632bae26d5f19c32481953936a35574..984e379d2784921aac3ca45a9ab5735dcd506e62 100644 (file)
@@ -200,28 +200,27 @@ TEST_P(ArfFreqTestLarge, MinArfFreqTest) {
   if (cfg_.g_bit_depth > 8)
     init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
 
-  libvpx_test::VideoSource *video;
+  testing::internal::scoped_ptr<libvpx_test::VideoSource> video;
   if (is_extension_y4m(test_video_param_.filename)) {
-    video = new libvpx_test::Y4mVideoSource(test_video_param_.filename,
-                                            0, kFrames);
+    video.reset(new libvpx_test::Y4mVideoSource(test_video_param_.filename,
+                                                0, kFrames));
   } else {
-    video = new libvpx_test::YUVVideoSource(test_video_param_.filename,
-                                            test_video_param_.fmt,
-                                            test_video_param_.width,
-                                            test_video_param_.height,
-                                            test_video_param_.framerate_num,
-                                            test_video_param_.framerate_den,
-                                            0, kFrames);
+    video.reset(new libvpx_test::YUVVideoSource(test_video_param_.filename,
+                                                test_video_param_.fmt,
+                                                test_video_param_.width,
+                                                test_video_param_.height,
+                                                test_video_param_.framerate_num,
+                                                test_video_param_.framerate_den,
+                                                0, kFrames));
   }
 
-  ASSERT_NO_FATAL_FAILURE(RunLoop(video));
+  ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
   const int min_run = GetMinVisibleRun();
   const int min_arf_dist_requested = GetMinArfDistanceRequested();
   if (min_run != ARF_NOT_SEEN && min_run != ARF_SEEN_ONCE) {
     const int min_arf_dist = min_run + 1;
     EXPECT_GE(min_arf_dist, min_arf_dist_requested);
   }
-  delete(video);
 }
 
 VP9_INSTANTIATE_TEST_CASE(