10BC0 Simplify defer calls · seccomp/libseccomp-golang@36c97cf · GitHub
[go: up one dir, main page]

Skip to content

Commit 36c97cf

Browse files
committed
Simplify defer calls
There is no need to introduce and use a func here. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1 parent 5143533 commit 36c97cf

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

seccomp_internal.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -818,10 +818,7 @@ func notifReceive(fd ScmpFd) (*ScmpNotifReq, error) {
818818
if retCode := C.seccomp_notify_alloc(&req, &resp); retCode != 0 {
819819
return nil, errRc(retCode)
820820
}
821-
822-
defer func() {
823-
C.seccomp_notify_free(req, resp)
824-
}()
821+
defer C.seccomp_notify_free(req, resp)
825822

826823
for {
827824
retCode, errno := C.seccomp_notify_receive(C.int(fd), req)
@@ -855,10 +852,7 @@ func notifRespond(fd ScmpFd, scmpResp *ScmpNotifResp) error {
855852
if retCode := C.seccomp_notify_alloc(&req, &resp); retCode != 0 {
856853
return errRc(retCode)
857854
}
858-
859-
defer func() {
860-
C.seccomp_notify_free(req, resp)
861-
}()
855+
defer C.seccomp_notify_free(req, resp)
862856

863857
scmpResp.toNative(resp)
864858

0 commit comments

Comments
 (0)
0