f10d51
diff -Naur psmisc-22.20.orig/src/pstree.c psmisc-22.20/src/pstree.c
f10d51
--- psmisc-22.20.orig/src/pstree.c	2013-10-21 15:31:15.000000000 +0200
f10d51
+++ psmisc-22.20/src/pstree.c	2013-10-21 15:30:58.000000000 +0200
f10d51
@@ -222,7 +222,12 @@
f10d51
     }
f10d51
 
f10d51
     if (!ptr) {
f10d51
-        ptr = malloc(sizeof(*ptr));
f10d51
+
f10d51
+        if (!(ptr = malloc(sizeof(*ptr)))) {
f10d51
+            perror("malloc");
f10d51
+            exit(1);
f10d51
+        }
f10d51
+
f10d51
         memset(ptr, 0, sizeof(*ptr));
f10d51
         ptr->number = r->ns[id];
f10d51
         if (*root == NULL)
f10d51
@@ -234,7 +239,12 @@
f10d51
     /* move the child to under the namespace's umbrella */
f10d51
     for (c = &ptr->children; *c; c = &(*c)->next)
f10d51
         ;
f10d51
-    *c = malloc(sizeof(CHILD));
f10d51
+
f10d51
+    if (!(*c = malloc(sizeof(CHILD)))) {
f10d51
+        perror("malloc");
f10d51
+        exit(1);
f10d51
+    }
f10d51
+
f10d51
     (*c)->child = r;
f10d51
     (*c)->next = NULL;
f10d51