Fixed two memory sanity issues found with valgrind

This commit is contained in:
Matthias Koefferlein 2025-11-08 14:04:07 +01:00
parent 448ebcc8c6
commit da0558e7b4
1 changed files with 3 additions and 1 deletions

View File

@ -443,7 +443,7 @@ Reader::do_read_internal (db::Layout &layout)
m_stream.reset (); m_stream.reset ();
size_t nhdr = strlen (LStream_sig) + 1; size_t nhdr = strlen (LStream_sig) + 1;
std::unique_ptr<char> hdr (new char [nhdr]); std::unique_ptr<char[]> hdr (new char [nhdr]);
size_t nhdr_read = m_stream.tryRead (hdr.get (), nhdr, nhdr); size_t nhdr_read = m_stream.tryRead (hdr.get (), nhdr, nhdr);
if (nhdr_read != nhdr || memcmp (LStream_sig, hdr.get (), nhdr) != 0) { if (nhdr_read != nhdr || memcmp (LStream_sig, hdr.get (), nhdr) != 0) {
error (tl::to_string (tr ("LStream format not recognized (missing magic bytes)"))); error (tl::to_string (tr ("LStream format not recognized (missing magic bytes)")));
@ -731,6 +731,8 @@ Reader::read_cells (stream::library::Library::Reader library)
db::CommonReaderLayerMapping layer_mapping (this, mp_layout); db::CommonReaderLayerMapping layer_mapping (this, mp_layout);
mp_layout->recover_proxy_as (cell_index, context_info, &layer_mapping); mp_layout->recover_proxy_as (cell_index, context_info, &layer_mapping);
cell = &mp_layout->cell (cell_index);
} }
cell->prop_id (get_properties_id_by_id (l->getPropertySetId ())); cell->prop_id (get_properties_id_by_id (l->getPropertySetId ()));