Refactor file_store to use smart pointers
Bug: b/119276649 Merge from: http://go/wvgerrit/66367 Test: Android, CE CDM, Linux unit tests The FileSystem interface as it exists expects an Open for a file and then a Close when finished. However, the Close doesn't delete the file itself and depending on the platform, the underlying impl_ as well, leading to a memory leak. To fix this leak as well as harden against future memory issues, this change refactors the interface to shift away from raw pointers and towards smart pointers. Change-Id: I7a7132ea95cd3775796a540f510b698f4f27dd24
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
|
||||
#include "level3_file_system.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "file_store.h"
|
||||
|
||||
namespace wvoec3 {
|
||||
@@ -29,7 +31,7 @@ class OEMCrypto_Level3AndroidFileSystem : public OEMCrypto_Level3FileSystem {
|
||||
|
||||
private:
|
||||
std::string base_path_;
|
||||
wvcdm::FileSystem *file_system_;
|
||||
std::unique_ptr<wvcdm::FileSystem> file_system_;
|
||||
};
|
||||
|
||||
} // namespace wvoec3
|
||||
|
||||
Reference in New Issue
Block a user