]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/vm/default_freezer.c
xnu-2782.1.97.tar.gz
[apple/xnu.git] / osfmk / vm / default_freezer.c
index b7127b39e693ece577817fe188f97a5010b1b955..d6601a2272cd02b5800f22699590191e5ebdc6dc 100644 (file)
@@ -845,9 +845,23 @@ default_freezer_handle_deallocate_locked(
        assert(df_handle);
        df_handle->dfh_ref_count--;
        if (df_handle->dfh_ref_count == 0) {
+
+               if (df_handle->dfh_compact_object) {
+                       vm_object_deallocate(df_handle->dfh_compact_object);
+                       df_handle->dfh_compact_object = NULL;
+                       df_handle->dfh_compact_offset = 0;
+               }
+                       
+               if (df_handle->dfh_table) {
+                       default_freezer_mapping_free(&df_handle->dfh_table, TRUE);
+                       df_handle->dfh_table = NULL;
+               }
+       
+               lck_rw_done(&df_handle->dfh_lck);
                lck_rw_destroy(&df_handle->dfh_lck, &default_freezer_handle_lck_grp);
-               kfree(df_handle, sizeof(struct default_freezer_handle));
                should_unlock = FALSE;
+
+               kfree(df_handle, sizeof(struct default_freezer_handle));
        }
        return should_unlock;
 }