mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-17 06:59:43 -05:00
Fix a bunch of mistakes detected with scan-build
This commit is contained in:
parent
ac78c6642a
commit
bb79ada49f
10 changed files with 19 additions and 9 deletions
|
|
@ -636,7 +636,10 @@ static void data_device_start_drag(struct wl_client *client,
|
|||
|
||||
if (!seat_client_start_drag(seat_client, source, icon)) {
|
||||
wl_resource_post_no_memory(device_resource);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (source) {
|
||||
source->seat_client = seat_client;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,10 @@ void wlr_keyboard_init(struct wlr_keyboard *kb,
|
|||
}
|
||||
|
||||
void wlr_keyboard_destroy(struct wlr_keyboard *kb) {
|
||||
if (kb && kb->impl && kb->impl->destroy) {
|
||||
if (kb == NULL) {
|
||||
return;
|
||||
}
|
||||
if (kb->impl && kb->impl->destroy) {
|
||||
kb->impl->destroy(kb);
|
||||
} else {
|
||||
wl_list_remove(&kb->events.key.listener_list);
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ static void screenshooter_shoot(struct wl_client *client,
|
|||
struct wlr_screenshot *screenshot =
|
||||
calloc(1, sizeof(struct wlr_screenshot));
|
||||
if (!screenshot) {
|
||||
free(pixels);
|
||||
wl_resource_post_no_memory(screenshooter_resource);
|
||||
return;
|
||||
}
|
||||
|
|
@ -96,6 +97,7 @@ static void screenshooter_shoot(struct wl_client *client,
|
|||
wl_resource_get_version(screenshooter_resource), id);
|
||||
if (screenshot->resource == NULL) {
|
||||
free(screenshot);
|
||||
free(pixels);
|
||||
wl_resource_post_no_memory(screenshooter_resource);
|
||||
return;
|
||||
}
|
||||
|
|
@ -109,6 +111,7 @@ static void screenshooter_shoot(struct wl_client *client,
|
|||
if (!state) {
|
||||
wl_resource_destroy(screenshot->resource);
|
||||
free(screenshot);
|
||||
free(pixels);
|
||||
wl_resource_post_no_memory(screenshooter_resource);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ static void shell_surface_protocol_set_popup(struct wl_client *client,
|
|||
transient_state->flags = flags;
|
||||
|
||||
struct wlr_wl_shell_surface_popup_state *popup_state =
|
||||
calloc(1, sizeof(struct wlr_wl_shell_surface_transient_state));
|
||||
calloc(1, sizeof(struct wlr_wl_shell_surface_popup_state));
|
||||
if (popup_state == NULL) {
|
||||
free(transient_state);
|
||||
wl_client_post_no_memory(client);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue