diff options
author | Aaron Giles <aaron@aarongiles.com> | 2012-02-19 02:01:54 +0000 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2012-02-19 02:01:54 +0000 |
commit | a33c799e2297e0ada2371885412bad766cb6221a (patch) | |
tree | b85be3d6a9bf432678b1185ce1fe1b8aa72a413e | |
parent | 1db230096b54f092e1234a583fce3a2ffbfecd16 (diff) |
free_file_line no longer complains about NULL free's not existing.
Removed unnecessary checks for NULL that were added due to the
previous problem.
-rw-r--r-- | src/emu/emualloc.c | 4 | ||||
-rw-r--r-- | src/lib/util/coretmpl.h | 4 |
2 files changed, 6 insertions, 2 deletions
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; } |