Skip to content

Commit

Permalink
removed dbBlock::duplicate which causes memory corruption issues
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Ng <jeffng@precisioninno.com>
  • Loading branch information
jeffng-or committed Jan 15, 2025
1 parent 40757a9 commit 8ebfd1f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 39 deletions.
11 changes: 0 additions & 11 deletions src/odb/include/odb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
28 changes: 0 additions & 28 deletions src/odb/src/db/dbBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down

0 comments on commit 8ebfd1f

Please sign in to comment.