I'm getting a memory leak with the following code:
// in function, I copy a slice into an ArrayList([]const u8)
const value_copy = try allocator.dupe(u8, value);
try innerArray.append(value_copy);
// in test, I want to free that memory:
var ret_struct = Config{
.innerArray = std.ArrayList([]const u8).init(allocator),
};
const result = try readToStruct(&ret_struct, &parser, allocator);
defer ret_struct.innerArray.deinit();
How am I supposed to do this?