diff --git a/Checkpoint.cpp b/Checkpoint.cpp
index 5d1ec1f..1833733 100644
--- a/Checkpoint.cpp
+++ b/Checkpoint.cpp
@@ -19,6 +19,7 @@
 
 #include <fstream>
 #include <list>
+#include <memory>
 #include <string>
 #include <vector>
 
@@ -82,19 +83,19 @@
     // To do this, we walk the list of mounted file systems.
     // But we also need to get the matching fstab entries to see
     // the original flags
-    struct fstab* fstab = fs_mgr_read_fstab_default();
-    if (!fstab) return false;
+    auto fstab_default = std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)>{
+        fs_mgr_read_fstab_default(), fs_mgr_free_fstab};
+    if (!fstab_default) return false;
 
-    struct fstab* mounts = fs_mgr_read_fstab("/proc/mounts");
-    if (mounts == NULL) {
-        fs_mgr_free_fstab(fstab);
-        return false;
-    }
+    auto mounts = std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)>{
+        fs_mgr_read_fstab("/proc/mounts"), fs_mgr_free_fstab};
+    if (!mounts) return false;
 
     // Walk mounted file systems
     for (int i = 0; i < mounts->num_entries; ++i) {
         const fstab_rec* mount_rec = &mounts->recs[i];
-        const fstab_rec* fstab_rec = fs_mgr_get_entry_for_mount_point(fstab, mount_rec->mount_point);
+        const fstab_rec* fstab_rec =
+            fs_mgr_get_entry_for_mount_point(fstab_default.get(), mount_rec->mount_point);
         if (!fstab_rec) continue;
 
         if (fs_mgr_is_checkpoint_fs(fstab_rec)) {
@@ -106,8 +107,6 @@
             setBowState(mount_rec->blk_device, "2");
         }
     }
-    fs_mgr_free_fstab(mounts);
-    fs_mgr_free_fstab(fstab);
     return android::base::RemoveFileIfExists(kMetadataCPFile);
 }
 
@@ -150,18 +149,18 @@
 }
 
 bool cp_prepareDriveForCheckpoint(const std::string&) {
-    struct fstab* fstab = fs_mgr_read_fstab_default();
-    if (!fstab) return false;
+    auto fstab_default = std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)>{
+        fs_mgr_read_fstab_default(), fs_mgr_free_fstab};
+    if (!fstab_default) return false;
 
-    struct fstab* mounts = fs_mgr_read_fstab("/proc/mounts");
-    if (mounts == NULL) {
-        fs_mgr_free_fstab(fstab);
-        return false;
-    }
+    auto mounts = std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)>{
+        fs_mgr_read_fstab("/proc/mounts"), fs_mgr_free_fstab};
+    if (!mounts) return false;
 
     for (int i = 0; i < mounts->num_entries; ++i) {
         const fstab_rec* mount_rec = &mounts->recs[i];
-        const fstab_rec* fstab_rec = fs_mgr_get_entry_for_mount_point(fstab, mount_rec->mount_point);
+        const fstab_rec* fstab_rec =
+            fs_mgr_get_entry_for_mount_point(fstab_default.get(), mount_rec->mount_point);
         if (!fstab_rec) continue;
 
         if (fs_mgr_is_checkpoint_blk(fstab_rec)) {
@@ -182,8 +181,6 @@
             setBowState(mount_rec->blk_device, "1");
         }
     }
-    fs_mgr_free_fstab(mounts);
-    fs_mgr_free_fstab(fstab);
     return true;
 }
 
