Skip to content

Commit 463e7c8

Browse files
chkuang-ga-maurice
authored andcommitted
Use Variant(const& std::string) instead of Variant(const char*) to store hash.
Variant(const char*) would store the pointer in the variant. Since the request was held until Database connection is established, the pointed memory has been changed already. PiperOrigin-RevId: 259074121
1 parent 74624f6 commit 463e7c8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

database/src/desktop/connection/persistent_connection.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ void PersistentConnection::PutInternal(const char* action, const Path& path,
791791
request.map()[kRequestPath] = path.str();
792792
request.map()[kRequestDataPayload] = data;
793793
if (hash != nullptr) {
794-
request.map()[kRequestDataHash] = hash;
794+
request.map()[kRequestDataHash] = std::string(hash);
795795
}
796796

797797
uint64_t write_id = next_write_id_++;

0 commit comments

Comments
 (0)