Change errdefers in create()/init() functions
They should use gpa.destroy() instead of foo.destroy() because (most) of them have fields that may not be initialized by the first error, so the foo.destroy() could crash.
This commit is contained in:
parent
2b336299eb
commit
6bf607b759
11 changed files with 12 additions and 11 deletions
|
|
@ -78,6 +78,7 @@ pub fn initSurface(bar: *Bar) !void {
|
|||
|
||||
pub fn deinit(bar: *Bar) void {
|
||||
bar.configured = false;
|
||||
bar.timezone.deinit();
|
||||
if (bar.wl_surface) |wl_surface| {
|
||||
wl_surface.destroy();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue