if (pos < stack->size)
                free(stack->stack[pos]);
        else {
-               if (!stack->stack)
-                       stack->stack = malloc_or_die(sizeof(char *) * STK_BLK);
-               else
-                       stack->stack = realloc(stack->stack, sizeof(char *) *
-                                              (stack->size + STK_BLK));
+               char **ptr;
+
+               ptr = realloc(stack->stack, sizeof(char *) *
+                             (stack->size + STK_BLK));
+               if (!ptr) {
+                       warning("could not allocate plugin memory\n");
+                       return;
+               }
+
+               stack->stack = ptr;
+
                for (i = stack->size; i < stack->size + STK_BLK; i++)
                        stack->stack[i] = NULL;
                stack->size += STK_BLK;
                return 0;
 
        if (cpu > cpus) {
-               if (fstack)
-                       fstack = realloc(fstack, sizeof(*fstack) * (cpu + 1));
-               else
-                       fstack = malloc_or_die(sizeof(*fstack) * (cpu + 1));
+               struct func_stack *ptr;
+
+               ptr = realloc(fstack, sizeof(*fstack) * (cpu + 1));
+               if (!ptr) {
+                       warning("could not allocate plugin memory\n");
+                       return 0;
+               }
+
+               fstack = ptr;
 
                /* Account for holes in the cpu count */
                for (i = cpus + 1; i <= cpu; i++)