[hermes] Fix memory leak (#881)

This commit is contained in:
Ali Behjati 2023-06-13 17:11:47 +02:00 committed by GitHub
parent 19b77e2c84
commit f394d9e761
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

2
hermes/Cargo.lock generated
View File

@ -1926,7 +1926,7 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermes"
version = "0.1.0"
version = "0.1.1"
dependencies = [
"anyhow",
"async-trait",

View File

@ -1,6 +1,6 @@
[package]
name = "hermes"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
[dependencies]

View File

@ -203,11 +203,11 @@ func RegisterObservationCallback(f C.callback_t, network_id, bootstrap_addrs, li
case *GossipMessage_SignedVaaWithQuorum:
vaaBytes := msg.GetSignedVaaWithQuorum().GetVaa()
cBytes := C.CBytes(vaaBytes)
defer C.free(cBytes)
C.invoke(f, C.observation_t{
vaa: (*C.char)(cBytes),
vaa_len: C.size_t(len(vaaBytes)),
})
C.free(cBytes)
}
}
}