Don't retain references to passed byte slices (#40)
This commit is contained in:
parent
9caf737bc7
commit
10a9a0f557
4 changed files with 17 additions and 9 deletions
|
|
@ -11,3 +11,11 @@ type GopenPGP struct {
|
|||
}
|
||||
|
||||
var pgp = GopenPGP{}
|
||||
|
||||
// clone returns a clone of the byte slice. Internal function used to make sure
|
||||
// we don't retain a reference to external data.
|
||||
func clone(input []byte) []byte {
|
||||
data := make([]byte, len(input))
|
||||
copy(data, input)
|
||||
return data
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue