Skip to content

Commit 2862d98

Browse files
committed
api: initialize OCI LinuxMemory resources to empty.
When converting to OCI LinuxResources, always use an empty &LinuxMemory{} instead of a nil one. Some runtimes try to dereference it unconditionally. Leaving it unset panics on these. Signed-off-by: Krisztian Litkey <[email protected]>
1 parent 2a8b655 commit 2862d98

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

pkg/api/resources.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ func (r *LinuxResources) ToOCI() *rspec.LinuxResources {
100100
if r == nil {
101101
return nil
102102
}
103-
o := &rspec.LinuxResources{}
103+
o := &rspec.LinuxResources{
104+
CPU: &rspec.LinuxCPU{},
105+
Memory: &rspec.LinuxMemory{},
106+
}
104107
if r.Memory != nil {
105108
o.Memory = &rspec.LinuxMemory{
106109
Limit: r.Memory.Limit.Get(),

0 commit comments

Comments
 (0)