From 870fd2e0bdecac332f4ef07828151538d852ce9c Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Thu, 8 Apr 2021 23:30:47 +0200 Subject: [PATCH] Fixed some valgrind issues. --- src/db/db/dbCompoundOperation.cc | 5 +---- src/db/db/dbPolygonTools.cc | 2 +- src/db/unit_tests/dbCompoundOperationTests.cc | 1 + src/plugins/streamers/gds2/db_plugin/dbGDS2Reader.cc | 8 +++++++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/db/db/dbCompoundOperation.cc b/src/db/db/dbCompoundOperation.cc index db4aedd84..e3e9b8d7c 100644 --- a/src/db/db/dbCompoundOperation.cc +++ b/src/db/db/dbCompoundOperation.cc @@ -357,10 +357,7 @@ CompoundRegionMultiInputOperationNode::init () CompoundRegionMultiInputOperationNode::~CompoundRegionMultiInputOperationNode () { - for (tl::shared_collection::iterator i = m_children.begin (); i != m_children.end (); ++i) { - delete i.operator-> (); - } - m_children.clear (); + // .. nothing yet .. } void diff --git a/src/db/db/dbPolygonTools.cc b/src/db/db/dbPolygonTools.cc index 808133e68..6d37ab289 100644 --- a/src/db/db/dbPolygonTools.cc +++ b/src/db/db/dbPolygonTools.cc @@ -1626,7 +1626,7 @@ AreaMap::reinitialize (const db::Point &p0, const db::Vector &d, const db::Vecto m_ny = ny; if (mp_av) { - delete mp_av; + delete[] mp_av; } mp_av = new area_type [nx * ny]; diff --git a/src/db/unit_tests/dbCompoundOperationTests.cc b/src/db/unit_tests/dbCompoundOperationTests.cc index a465fc28f..a0d305afa 100644 --- a/src/db/unit_tests/dbCompoundOperationTests.cc +++ b/src/db/unit_tests/dbCompoundOperationTests.cc @@ -99,6 +99,7 @@ void run_test1 (tl::TestBase *_this, bool deep) unsigned int l1002 = ly.get_layer (db::LayerProperties (1002, 0)); res.insert_into (&ly, *ly.begin_top_down (), l1002); + primary = new db::CompoundRegionOperationPrimaryNode (); db::CompoundRegionCheckOperationNode space_check (primary, db::SpaceRelation, false /*==all polygons*/, 1050, check_options); res = r.cop_to_edge_pairs (space_check); diff --git a/src/plugins/streamers/gds2/db_plugin/dbGDS2Reader.cc b/src/plugins/streamers/gds2/db_plugin/dbGDS2Reader.cc index 8d974cb6d..ae3a6dfb7 100644 --- a/src/plugins/streamers/gds2/db_plugin/dbGDS2Reader.cc +++ b/src/plugins/streamers/gds2/db_plugin/dbGDS2Reader.cc @@ -206,7 +206,13 @@ GDS2Reader::get_string () void GDS2Reader::get_string (std::string &s) const { - s.assign ((const char *) mp_rec_buf, 0, m_reclen); + if (m_reclen == 0) { + s.clear (); + } else if (mp_rec_buf [m_reclen - 1] != 0) { + s.assign ((const char *) mp_rec_buf, m_reclen); + } else { + s.assign ((const char *) mp_rec_buf, m_reclen - 1); + } } void