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