VMAnonymousCache: Use new/delete instead of malloc/free.

This commit is contained in:
Augustin Cavalier
2022-11-29 22:34:43 -05:00
parent 549abba75f
commit 8f75eaafd0
+3 -3
View File
@@ -1454,7 +1454,7 @@ swap_file_add(const char* path)
} }
// do the allocations and prepare the swap_file structure // do the allocations and prepare the swap_file structure
swap_file* swap = (swap_file*)malloc(sizeof(swap_file)); swap_file* swap = new swap_file;
if (swap == NULL) { if (swap == NULL) {
close(fd); close(fd);
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -1467,7 +1467,7 @@ swap_file_add(const char* path)
uint32 pageCount = st.st_size >> PAGE_SHIFT; uint32 pageCount = st.st_size >> PAGE_SHIFT;
swap->bmp = radix_bitmap_create(pageCount); swap->bmp = radix_bitmap_create(pageCount);
if (swap->bmp == NULL) { if (swap->bmp == NULL) {
free(swap); delete swap;
close(fd); close(fd);
return B_NO_MEMORY; return B_NO_MEMORY;
} }
@@ -1534,7 +1534,7 @@ swap_file_delete(const char* path)
close(swapFile->fd); close(swapFile->fd);
radix_bitmap_destroy(swapFile->bmp); radix_bitmap_destroy(swapFile->bmp);
free(swapFile); delete swapFile;
return B_OK; return B_OK;
} }