Issue #5: Return error on memory failures when adding to the queue.