Introduced with the namespaces support
References:
https://sourceforge.net/p/psmisc/patches/32/
https://sourceforge.net/p/psmisc/code/ci/
e64b282643afecb7060c321f8401872feaf07dbb/log/?path=
Signed-off-by: Craig Small <csmall@enc.com.au>
}
if (!ptr) {
- ptr = malloc(sizeof(*ptr));
+
+ if (!(ptr = malloc(sizeof(*ptr)))) {
+ perror("malloc");
+ exit(1);
+ }
+
memset(ptr, 0, sizeof(*ptr));
ptr->number = r->ns[id];
if (*root == NULL)
/* move the child to under the namespace's umbrella */
for (c = &ptr->children; *c; c = &(*c)->next)
;
- *c = malloc(sizeof(CHILD));
+
+ if (!(*c = malloc(sizeof(CHILD)))) {
+ perror("malloc");
+ exit(1);
+ }
+
(*c)->child = r;
(*c)->next = NULL;