From 6dbd9f1c992fbdbc438abe10dc2162ca5d1c7b8d Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Tue, 7 Jan 2020 12:43:16 +0100 Subject: [PATCH] Remove superfluous asserts. Operator new will throw std::bad_alloc when running out of memory. --- devices/memctrlbase.cpp | 2 -- main.cpp | 3 --- 2 files changed, 5 deletions(-) diff --git a/devices/memctrlbase.cpp b/devices/memctrlbase.cpp index b07c582..6511461 100644 --- a/devices/memctrlbase.cpp +++ b/devices/memctrlbase.cpp @@ -50,8 +50,6 @@ bool MemCtrlBase::add_mem_region(uint32_t start_addr, uint32_t size, return false; uint8_t *reg_content = new uint8_t[size]; - if (!reg_content) - return false; this->mem_regions.push_back(reg_content); diff --git a/main.cpp b/main.cpp index 3b9c14c..418e1c1 100644 --- a/main.cpp +++ b/main.cpp @@ -10,7 +10,6 @@ #include #include -#include #include #include #include @@ -435,11 +434,9 @@ int main(int argc, char **argv) return 1; } machine_id = new GossamerID(0x3d8c); - assert(machine_id != 0); mpc106->add_mmio_region(0xFF000004, 4096, machine_id); heathrow = new HeathrowIC(); - assert(heathrow != 0); mpc106->pci_register_device(16, heathrow); cout << "done" << endl; }