Can someone explain to me why this initialization is incorrect?

Add initialization in init.

    pub fn init(allocator: std.mem.Allocator) !?*Self {
        var self = try allocator.create(Self);
        self.head = null;
        self.tail = null;
        self.size = 0;
        return self;
    }

Explanation is here: Allocation is not Initialization

4 Likes