aboutsummaryrefslogtreecommitdiffstats
path: root/lib/siscomponentrecord.cpp
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 /lib/siscomponentrecord.cpp
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.
Diffstat (limited to 'lib/siscomponentrecord.cpp')
-rw-r--r--lib/siscomponentrecord.cpp14
1 files changed, 11 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