Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main: Fix double nvnc_close() #340

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ static int init_nvnc(struct wayvnc* self, const char* addr, uint16_t port,

self->nvnc_display = nvnc_display_new(0, 0);
if (!self->nvnc_display)
goto failure;
goto display_failure;

nvnc_add_display(self->nvnc, self->nvnc_display);

Expand All @@ -947,7 +947,7 @@ static int init_nvnc(struct wayvnc* self, const char* addr, uint16_t port,
if (self->cfg.enable_auth) {
if (nvnc_enable_auth(self->nvnc, auth_flags, on_auth, self) < 0) {
nvnc_log(NVNC_LOG_ERROR, "Failed to enable authentication");
goto failure;
goto auth_failure;
}

if (self->cfg.rsa_private_key_file) {
Expand All @@ -956,7 +956,7 @@ static int init_nvnc(struct wayvnc* self, const char* addr, uint16_t port,
self->cfg.rsa_private_key_file);
if (nvnc_set_rsa_creds(self->nvnc, key_file) < 0) {
nvnc_log(NVNC_LOG_ERROR, "Failed to load RSA credentials");
goto failure;
goto auth_failure;
}
}

Expand All @@ -972,7 +972,7 @@ static int init_nvnc(struct wayvnc* self, const char* addr, uint16_t port,
cert_file);
if (r < 0) {
nvnc_log(NVNC_LOG_ERROR, "Failed to enable TLS authentication");
goto failure;
goto auth_failure;
}
}
}
Expand All @@ -986,11 +986,14 @@ static int init_nvnc(struct wayvnc* self, const char* addr, uint16_t port,
nvnc_set_cut_text_fn(self->nvnc, on_client_cut_text);

if (blank_screen(self) != 0)
goto failure;
goto blank_screen_failure;

return 0;

failure:
blank_screen_failure:
auth_failure:
nvnc_display_unref(self->nvnc_display);
display_failure:
nvnc_close(self->nvnc);
return -1;
}
Expand Down Expand Up @@ -2128,8 +2131,6 @@ int main(int argc, char* argv[])
ctl_server_destroy(self.ctl);
ctl_server_failure:
screencopy_failure:
nvnc_display_unref(self.nvnc_display);
nvnc_close(self.nvnc);
wayland_failure:
aml_unref(aml);
failure:
Expand Down
Loading