diff --git a/src/emu/emualloc.c b/src/emu/emualloc.c index c46b64e89e6..105e4f14eda 100644 --- a/src/emu/emualloc.c +++ b/src/emu/emualloc.c @@ -191,6 +191,10 @@ void *malloc_array_file_line(size_t size, const char *file, int line) void free_file_line(void *memory, const char *file, int line) { + // ignore NULL frees/deletes + if (memory == NULL) + return; + // find the memory entry memory_entry *entry = memory_entry::find(memory); diff --git a/src/lib/util/coretmpl.h b/src/lib/util/coretmpl.h index db1d6c1e930..59e012fe753 100644 --- a/src/lib/util/coretmpl.h +++ b/src/lib/util/coretmpl.h @@ -76,7 +76,7 @@ public: // helpers void append(const _ElementType &element) { if (m_count == m_allocated) expand_internal((m_allocated == 0) ? 16 : (m_allocated << 1), true); m_array[m_count++] = element; } - void reset() { if (m_array) delete[] m_array; m_array = NULL; m_count = m_allocated = 0; } + void reset() { delete[] m_array; m_array = NULL; m_count = m_allocated = 0; } void resize(int count, bool keepdata = false) { if (count > m_allocated) expand_internal(count, keepdata); m_count = count; } private: @@ -89,7 +89,7 @@ private: if (keepdata) for (int index = 0; index < m_count; index++) newarray[index] = m_array[index]; - if (m_array) delete[] m_array; + delete[] m_array; m_array = newarray; }