Package: cgmanager / 0.33-2+deb8u2

0005-prevent-some-cgmanager-asserts.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From c56249afbccfb66f4896c1fc3380e7c1459c1afc Mon Sep 17 00:00:00 2001
From: Serge Hallyn <serge.hallyn@ubuntu.com>
Date: Mon, 29 Dec 2014 01:19:56 -0600
Subject: [PATCH 4/4] prevent some cgmanager asserts

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
---
 cgmanager.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Index: cgmanager-0.33/cgmanager.c
===================================================================
--- cgmanager-0.33.orig/cgmanager.c
+++ cgmanager-0.33/cgmanager.c
@@ -899,7 +899,8 @@ int get_tasks_main(void *parent, const c
 
 	*pids = NULL;
 	if (file_read_pids(parent, path, pids, &alloced_pids, &nrpids) < 0) {
-		nih_free(*pids);
+		if (*pids)
+			nih_free(*pids);
 		return -1;
 	}
 	return nrpids;
@@ -1007,7 +1008,8 @@ int get_tasks_recursive_main(void *paren
 	if (strcmp(controller, "all") != 0 && !strchr(controller, ',')) {
 		if (collect_tasks(parent, controller, cgroup, p, r, pids,
 				&alloced_pids, &nrpids) < 0) {
-			nih_free(*pids);
+			if (*pids)
+				nih_free(*pids);
 			return -1;
 		}
 		return nrpids;
@@ -1028,7 +1030,8 @@ int get_tasks_recursive_main(void *paren
 		if (ret == -2)  // permission denied - ignore
 			goto next;
 		if (ret != 0) {
-			nih_free(*pids);
+			if (*pids)
+				nih_free(*pids);
 			return -1;
 		}
 next: