lightningdevkit / ldk-c-bindings

Main LDK C Bindings on which other bindings are built
Other
13 stars 14 forks source link

Correct clone logic for `Str`. #45

Closed TheBlueMatt closed 3 years ago

TheBlueMatt commented 3 years ago

Previously we'd blindly clone'd the fields, which, if data_is_owned is set, will always result in a a double-free.

Instead, we always clone the underlying bytes, setting data_is_owned on the returned value since its likely the caller wants to hold onto the string outside of the current context.

TheBlueMatt commented 3 years ago

Oops, forgot to update to new upstream PRs, will land after CI.