Fix various bugs in HDF5 interface / MGXS code (found by valgrind)

This commit is contained in:
Paul Romano 2018-09-24 13:29:11 -05:00
parent 2afb1249b2
commit e2ed9c7553
3 changed files with 10 additions and 6 deletions

View file

@ -193,13 +193,13 @@ read_attribute(hid_t obj_id, const char* name, std::vector<std::string>& vec)
// Allocate a C char array to get strings
auto n = attribute_typesize(obj_id, name);
char buffer[m][n+1];
char buffer[m][n];
// Read char data in attribute
read_attr_string(obj_id, name, n, buffer[0]);
for (int i = 0; i < m; ++i) {
vec.emplace_back(&buffer[i][0]);
vec.emplace_back(&buffer[i][0], n);
}
}