From a520f2ff6e69761602d8f1b1c2e5854bd7f25aa6 Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Fri, 6 Jul 2007 12:08:52 +0000 Subject: Fix ComponentNameRecord: add a constructor to initialise m_names to NULL so that the destructor can test this and only delete initialised arrays. --- lib/siscomponentrecord.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/siscomponentrecord.cpp') diff --git a/lib/siscomponentrecord.cpp b/lib/siscomponentrecord.cpp index de382ad..bf44a3b 100644 --- a/lib/siscomponentrecord.cpp +++ b/lib/siscomponentrecord.cpp @@ -27,11 +27,19 @@ #include #include +SISComponentNameRecord::SISComponentNameRecord() +{ + m_names = NULL; +} + SISComponentNameRecord::~SISComponentNameRecord() { - for (int i = 0; i < m_nameCount; ++i) - delete[] m_names[i]; - delete[] m_names; + if (m_names) + { + for (int i = 0; i < m_nameCount; ++i) + delete[] m_names[i]; + delete[] m_names; + } } SisRC -- cgit v1.2.3