VOL-2112 move to voltha-lib-go
Change-Id: Ic1af08003c1d2c698c0cce371e64f47b47b8d875
diff --git a/vendor/github.com/DataDog/zstd/zstd.go b/vendor/github.com/DataDog/zstd/zstd.go
index e9953d6..b6af4eb 100644
--- a/vendor/github.com/DataDog/zstd/zstd.go
+++ b/vendor/github.com/DataDog/zstd/zstd.go
@@ -23,6 +23,7 @@
"bytes"
"errors"
"io/ioutil"
+ "runtime"
"unsafe"
)
@@ -84,6 +85,7 @@
C.size_t(len(src)),
C.int(level))
+ runtime.KeepAlive(src)
written := int(cWritten)
// Check if the return is an Error code
if err := getError(written); err != nil {
@@ -107,6 +109,7 @@
C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))),
C.size_t(len(src)))
+ runtime.KeepAlive(src)
written := int(cWritten)
// Check error
if err := getError(written); err != nil {
@@ -115,7 +118,7 @@
return dst[:written], nil
}
- if dst == nil {
+ if len(dst) == 0 {
// Attempt to use zStd to determine decompressed size (may result in error or 0)
size := int(C.size_t(C.ZSTD_getDecompressedSize(unsafe.Pointer(&src[0]), C.size_t(len(src)))))