[CRIU] [PATCH 23/28] seccomp: dump_seccomp_filters -- Be ready for chains absence

Cyrill Gorcunov gorcunov at gmail.com
Wed Mar 21 00:43:08 MSK 2018


From: Cyrill Gorcunov <gorcunov at openvz.org>

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 criu/seccomp.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/criu/seccomp.c b/criu/seccomp.c
index 90484cde5cb5..3416ba0c6060 100644
--- a/criu/seccomp.c
+++ b/criu/seccomp.c
@@ -311,9 +311,11 @@ static int dump_seccomp_filters(void)
 	}
 
 	se.n_seccomp_filters = nr_chains;
-	se.seccomp_filters = xmalloc(sizeof(*se.seccomp_filters) * nr_chains);
-	if (!se.seccomp_filters)
-		return -1;
+	if (nr_chains) {
+		se.seccomp_filters = xmalloc(sizeof(*se.seccomp_filters) * nr_chains);
+		if (!se.seccomp_filters)
+			return -1;
+	}
 
 	for (node = rb_first(&seccomp_tid_rb_root); node; node = rb_next(node)) {
 		entry = rb_entry(node, struct seccomp_entry, node);
-- 
2.14.3



More information about the CRIU mailing list