fix memory leak of char[] initialization
This commit is contained in:
parent
316ef305de
commit
2d13116487
@ -149,9 +149,8 @@ class InternalDataFacade final : public BaseDataFacade
|
||||
}
|
||||
|
||||
auto timestamp_size = storage::io::readTimestampSize(timestamp_stream);
|
||||
char *timestamp_ptr = new char[timestamp_size]();
|
||||
storage::io::readTimestamp(timestamp_stream, timestamp_ptr, timestamp_size);
|
||||
m_timestamp = std::string(timestamp_ptr);
|
||||
m_timestamp.resize(timestamp_size);
|
||||
storage::io::readTimestamp(timestamp_stream, &m_timestamp.front(), timestamp_size);
|
||||
}
|
||||
|
||||
void LoadGraph(const boost::filesystem::path &hsgr_path)
|
||||
|
@ -70,7 +70,9 @@ inline std::uint32_t readTimestampSize(boost::filesystem::ifstream ×tamp_in
|
||||
}
|
||||
|
||||
// Reads the timestamp in a file
|
||||
inline void readTimestamp(boost::filesystem::ifstream ×tamp_input_stream, char *timestamp, std::size_t timestamp_length)
|
||||
inline void readTimestamp(boost::filesystem::ifstream ×tamp_input_stream,
|
||||
char *timestamp,
|
||||
std::size_t timestamp_length)
|
||||
{
|
||||
timestamp_input_stream.read(timestamp, timestamp_length * sizeof(char));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user