mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
Memory leak in hdf5_interface.h read_dataset(std::string)
This commit is contained in:
parent
b442a7ad1a
commit
39f0d38367
1 changed files with 3 additions and 3 deletions
|
|
@ -247,11 +247,11 @@ inline void read_dataset(
|
|||
{
|
||||
// Create buffer to read data into
|
||||
auto n = dataset_typesize(obj_id, name);
|
||||
char* buffer = new char[n];
|
||||
std::vector<std::string::value_type> buffer(n, '\0');
|
||||
|
||||
// Read attribute and set string
|
||||
read_string(obj_id, name, n, buffer, indep);
|
||||
str = std::string {buffer, n};
|
||||
read_string(obj_id, name, n, buffer.data(), indep);
|
||||
str = std::string { buffer.begin(), buffer.end() };
|
||||
}
|
||||
|
||||
// array version
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue