Fix coverity reported resource leaks:
CID
1446217: (RESOURCE_LEAK)
Variable "filter" going out of scope leaks the storage it points to.
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {
ERROR("%s: prctl(PR_SET_NO_NEW_PRIVS) failed: %m\n", argv);
- return errno;
+ goto errout;
}
prog.len = (unsigned short) idx + 1;
if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog)) {
ERROR("%s: prctl(PR_SET_SECCOMP) failed: %m\n", argv);
- return errno;
+ goto errout;
}
return 0;
+
+errout:
+ free(filter);
+ return errno;
}