From 8ebfd1fe46d524f5856433388a557ee5bf789080 Mon Sep 17 00:00:00 2001 From: Jeff Ng Date: Wed, 15 Jan 2025 11:29:28 -0800 Subject: [PATCH] removed dbBlock::duplicate which causes memory corruption issues Signed-off-by: Jeff Ng --- src/odb/include/odb/db.h | 11 ----------- src/odb/src/db/dbBlock.cpp | 28 ---------------------------- 2 files changed, 39 deletions(-) diff --git a/src/odb/include/odb/db.h b/src/odb/include/odb/db.h index 799f61bd799..cba9c851e69 100644 --- a/src/odb/include/odb/db.h +++ b/src/odb/include/odb/db.h @@ -1728,17 +1728,6 @@ class dbBlock : public dbObject dbTech* tech = nullptr, char hier_delimeter = 0); - /// - /// duplicate - Make a duplicate of the specified "child" block. If name == - /// nullptr, the name of the block is also duplicated. If the duplicated block - /// does not have a unique name, then "findChild" may return an incorrect - /// block. UNIQUE child-block-names are not enforced! (This should be fixed)! - /// - /// A top-block can not be duplicated. This methods returns nullptr if the - /// specified block has not parent. - /// - static dbBlock* duplicate(dbBlock* block, const char* name = nullptr); - /// /// Translate a database-id back to a pointer. /// diff --git a/src/odb/src/db/dbBlock.cpp b/src/odb/src/db/dbBlock.cpp index 5a6262e935f..82a0d2398de 100644 --- a/src/odb/src/db/dbBlock.cpp +++ b/src/odb/src/db/dbBlock.cpp @@ -3158,34 +3158,6 @@ dbBlock* dbBlock::create(dbBlock* parent_, return (dbBlock*) child; } -dbBlock* dbBlock::duplicate(dbBlock* child_, const char* name_) -{ - _dbBlock* child = (_dbBlock*) child_; - - // must be a child block - if (child->_parent == 0) { - return nullptr; - } - - _dbBlock* parent = (_dbBlock*) child_->getParent(); - _dbChip* chip = (_dbChip*) child->getOwner(); - - // make a copy - _dbBlock* dup = chip->_block_tbl->duplicate(child); - - // link child-to-parent - parent->_children.push_back(dup->getOID()); - dup->_parent = parent->getOID(); - - if (name_ && dup->_name) { - free((void*) dup->_name); - dup->_name = strdup(name_); - ZALLOCATED(dup->_name); - } - - return (dbBlock*) dup; -} - dbBlock* dbBlock::getBlock(dbChip* chip_, uint dbid_) { _dbChip* chip = (_dbChip*) chip_;