Fix double free

This commit is contained in:
danielSanchezQ 2026-02-18 18:03:24 +00:00
parent 214a878851
commit 0824823598
2 changed files with 6 additions and 4 deletions

6
flake.lock generated
View File

@ -23,11 +23,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1771418281,
"narHash": "sha256-9nATUijKs7OCEcepHKghuWdgHu+hq11JbJz2Lv4uyDU=",
"lastModified": 1771428592,
"narHash": "sha256-J0bJOaHNUh7yDXLw4UajReywSSvN36JiY+e6tPMvqwM=",
"owner": "logos-blockchain",
"repo": "logos-blockchain",
"rev": "b862e6f640a79097b8a42c072e1f78bc430fa222",
"rev": "7a15c6474a5f9b7c12a36f43e3858b8dcf27ee40",
"type": "github"
},
"original": {

View File

@ -31,7 +31,9 @@ void LogosBlockchainModule::onNewBlockCallback(const char* block) {
QVariantList data;
data.append(QString::fromUtf8(block));
s_instance->emitEvent("newBlock", data);
free_cstring(const_cast<char*>(block)); // Free Rust-allocated memory
// SAFETY:
// We are getting an owned pointer here which is freed after this callback is called, so there is not need to
// free the resrouce here as we are copying the data!
}
}