Use unique_ptr and unique_fd to manager FDs.

Clean up leaky file descriptors in uncrypt/uncrypt.cpp. Add unique_fd
for open() and unique_file for fopen() to close FDs on destruction.

Bug: 21496020
Change-Id: I0174db0de9d5f59cd43b44757b8ef0f5912c91a2
This commit is contained in:
Tao Bao
2015-08-06 18:35:05 -07:00
parent e67104a6a7
commit c754792a07
3 changed files with 91 additions and 16 deletions
+2
View File
@@ -20,6 +20,8 @@ LOCAL_CLANG := true
LOCAL_SRC_FILES := uncrypt.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/..
LOCAL_MODULE := uncrypt
LOCAL_STATIC_LIBRARIES := libbase liblog libfs_mgr libcutils