summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2018-10-11 16:22:44 -0700
committerShentubot <shentubot@google.com>2018-10-11 16:23:54 -0700
commit3bc5e6482b110a03651abcfb02c93eef8a7ee90f (patch)
tree46748e7c8722db3af5e77625ede2e131bbb5f6ee
parentea5f6ed6ecab7f8b2648836117f62629b3c2cbb8 (diff)
Fix reference leak in tests.
PiperOrigin-RevId: 216780438 Change-Id: Ide637fe36f8d2a61fea9e5b16d1b3401f2540416
-rw-r--r--runsc/boot/loader_test.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/runsc/boot/loader_test.go b/runsc/boot/loader_test.go
index 10efa4427..7d35dcae2 100644
--- a/runsc/boot/loader_test.go
+++ b/runsc/boot/loader_test.go
@@ -398,8 +398,10 @@ func TestCreateMountNamespace(t *testing.T) {
root := mm.Root()
defer root.DecRef()
for _, p := range tc.expectedPaths {
- if _, err := mm.FindInode(ctx, root, root, p, 0); err != nil {
+ if d, err := mm.FindInode(ctx, root, root, p, 0); err != nil {
t.Errorf("expected path %v to exist with spec %v, but got error %v", p, tc.spec, err)
+ } else {
+ d.DecRef()
}
}
})