Fix the decoder init failed case in UT
Showing the changes to test/api/decode_api_test.cpp (1 of 5 files). Show all
Unified · Split
| @@ -766,6 +766,13 @@ const char* pHashStr[] = { //DO NOT CHANGE! · 765 unmodified lines | ||
| 766 | 766 | |
| 767 | 767 | class DecodeParseAPI : public ::testing::TestWithParam<EncodeDecodeFileParamBase>, public EncodeDecodeTestBase { |
| 768 | 768 | public: |
| 769 | + DecodeParseAPI() { | |
| 770 | + memset (&BsInfo_, 0, sizeof (SParserBsInfo)); | |
| 771 | + fYuv_ = NULL; | |
| 772 | + iWidth_ = 0; | |
| 773 | + iHeight_ = 0; | |
| 774 | + memset (&ctx_, 0, sizeof (SHA1Context)); | |
| 775 | + } | |
| 769 | 776 | void SetUp() { |
| 770 | 777 | SHA1Reset (&ctx_); |
| 771 | 778 | EncodeDecodeTestBase::SetUp(); |
| @@ -789,7 +796,9 @@ class DecodeParseAPI : public ::testing::TestWithParam<EncodeDecodeFileParamBase · 17 unmodified lines | ||
| 789 | 796 | } |
| 790 | 797 | void TearDown() { |
| 791 | 798 | EncodeDecodeTestBase::TearDown(); |
| 792 | − fclose (fYuv_); | |
| 799 | + if (fYuv_ != NULL) { | |
| 800 | + fclose (fYuv_); | |
| 801 | + } | |
| 793 | 802 | } |
| 794 | 803 | |
| 795 | 804 | void prepareEncDecParam (const EncodeDecodeFileParamBase p) { |