diff --git a/restore/pkg/restore/restore.go b/restore/pkg/restore/restore.go index b588c53a..3037a938 100644 --- a/restore/pkg/restore/restore.go +++ b/restore/pkg/restore/restore.go @@ -461,6 +461,8 @@ func (w *WorkerWriter) CreateXAttr(ino uint64, pos uint64, xattr XAttr) error { if xattrC.name == nil { return fmt.Errorf("failed to allocate xattr name") } + defer C.free(unsafe.Pointer(xattrC.name)) + copy((*[1 << 30]byte)(unsafe.Pointer(xattrC.name))[:len(xattr.Name)], []byte(xattr.Name)) xattrC.value = unsafe.Pointer(&xattr.Value[0])