aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2007-07-06 12:08:52 +0000
committerReuben Thomas <rrt@sc3d.org>2007-07-06 12:08:52 +0000
commita520f2ff6e69761602d8f1b1c2e5854bd7f25aa6 (patch)
tree007f8166e8290a61730debb4307b7ea09c77b6c8
parentcfabe7e35afaf53cbd24087b49d61363e6d8cafc (diff)
downloadplptools-a520f2ff6e69761602d8f1b1c2e5854bd7f25aa6.tar.gz
plptools-a520f2ff6e69761602d8f1b1c2e5854bd7f25aa6.tar.bz2
plptools-a520f2ff6e69761602d8f1b1c2e5854bd7f25aa6.zip
Fix ComponentNameRecord: add a constructor to initialise m_names to
NULL so that the destructor can test this and only delete initialised arrays.
-rw-r--r--lib/siscomponentrecord.cpp14
-rw-r--r--lib/siscomponentrecord.h1
2 files changed, 12 insertions, 3 deletions
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 <stdio.h>
#include <string.h>
+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
diff --git a/lib/siscomponentrecord.h b/lib/siscomponentrecord.h
index 1495c74..5e6519a 100644
--- a/lib/siscomponentrecord.h
+++ b/lib/siscomponentrecord.h
@@ -40,6 +40,7 @@ class SISComponentNameRecord
{
public:
+ SISComponentNameRecord();
virtual ~SISComponentNameRecord();
/**