MCPcopy
hub / github.com/awnumar/memguard / Destroy

Method Destroy

core/buffer.go:180–186  ·  view source on GitHub ↗

* Destroy performs some security checks, securely wipes the contents of, and then releases a Buffer's memory back to the OS. If a security check fails, the process will attempt to wipe all it can before safely panicking. If the Buffer has already been destroyed, the function does nothing and return

()

Source from the content-addressed store, hash-verified

178If the Buffer has already been destroyed, the function does nothing and returns nil.
179*/
180func (b *Buffer) Destroy() {
181 if err := b.destroy(); err != nil {
182 Panic(err)
183 }
184 // Remove this one from global slice.
185 buffers.remove(b)
186}
187
188func (b *Buffer) destroy() error {
189 if b == nil {

Callers 15

TestNewBufferFunction · 0.95
TestFreezeFunction · 0.95
TestMeltFunction · 0.95
TestCopyFunction · 0.95
TestCopyAtFunction · 0.95
TestMoveFunction · 0.95
TestMoveAtFunction · 0.95
TestScrambleFunction · 0.95
TestSizeFunction · 0.95
TestDestroyFunction · 0.95
TestIsAliveFunction · 0.95
TestIsMutableFunction · 0.95

Calls 3

destroyMethod · 0.95
PanicFunction · 0.85
removeMethod · 0.80

Tested by 15

TestNewBufferFunction · 0.76
TestFreezeFunction · 0.76
TestMeltFunction · 0.76
TestCopyFunction · 0.76
TestCopyAtFunction · 0.76
TestMoveFunction · 0.76
TestMoveAtFunction · 0.76
TestScrambleFunction · 0.76
TestSizeFunction · 0.76
TestDestroyFunction · 0.76
TestIsAliveFunction · 0.76
TestIsMutableFunction · 0.76