mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-23 05:15:58 +01:00
Merge pull request #1307 from emersion/static-analysis
Fix a few bugs found by the static analyzer
This commit is contained in:
commit
e0cf97da69
2 changed files with 17 additions and 14 deletions
|
@ -217,16 +217,16 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
|
||||||
backend, &multi->session, name, create_renderer_func);
|
backend, &multi->session, name, create_renderer_func);
|
||||||
if (subbackend == NULL) {
|
if (subbackend == NULL) {
|
||||||
wlr_log(WLR_ERROR, "failed to start backend '%s'", name);
|
wlr_log(WLR_ERROR, "failed to start backend '%s'", name);
|
||||||
wlr_backend_destroy(backend);
|
|
||||||
wlr_session_destroy(multi->session);
|
wlr_session_destroy(multi->session);
|
||||||
|
wlr_backend_destroy(backend);
|
||||||
free(names);
|
free(names);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wlr_multi_backend_add(backend, subbackend)) {
|
if (!wlr_multi_backend_add(backend, subbackend)) {
|
||||||
wlr_log(WLR_ERROR, "failed to add backend '%s'", name);
|
wlr_log(WLR_ERROR, "failed to add backend '%s'", name);
|
||||||
wlr_backend_destroy(backend);
|
|
||||||
wlr_session_destroy(multi->session);
|
wlr_session_destroy(multi->session);
|
||||||
|
wlr_backend_destroy(backend);
|
||||||
free(names);
|
free(names);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -272,8 +272,8 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
|
||||||
multi->session);
|
multi->session);
|
||||||
if (!libinput) {
|
if (!libinput) {
|
||||||
wlr_log(WLR_ERROR, "Failed to start libinput backend");
|
wlr_log(WLR_ERROR, "Failed to start libinput backend");
|
||||||
wlr_backend_destroy(backend);
|
|
||||||
wlr_session_destroy(multi->session);
|
wlr_session_destroy(multi->session);
|
||||||
|
wlr_backend_destroy(backend);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
wlr_multi_backend_add(backend, libinput);
|
wlr_multi_backend_add(backend, libinput);
|
||||||
|
@ -283,8 +283,8 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
|
||||||
if (!primary_drm) {
|
if (!primary_drm) {
|
||||||
wlr_log(WLR_ERROR, "Failed to open any DRM device");
|
wlr_log(WLR_ERROR, "Failed to open any DRM device");
|
||||||
wlr_backend_destroy(libinput);
|
wlr_backend_destroy(libinput);
|
||||||
wlr_backend_destroy(backend);
|
|
||||||
wlr_session_destroy(multi->session);
|
wlr_session_destroy(multi->session);
|
||||||
|
wlr_backend_destroy(backend);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,10 +188,9 @@ static void add_tablet_pad_group(struct wlr_tablet_v2_tablet_pad *pad,
|
||||||
struct wlr_tablet_pad_client_v2 *client,
|
struct wlr_tablet_pad_client_v2 *client,
|
||||||
struct wlr_tablet_pad_group *group, size_t index) {
|
struct wlr_tablet_pad_group *group, size_t index) {
|
||||||
|
|
||||||
int version = wl_resource_get_version(client->resource);
|
uint32_t version = wl_resource_get_version(client->resource);
|
||||||
client->groups[index] =
|
client->groups[index] = wl_resource_create(client->client,
|
||||||
wl_resource_create(client->client, &zwp_tablet_pad_group_v2_interface,
|
&zwp_tablet_pad_group_v2_interface, version, 0);
|
||||||
version, 0);
|
|
||||||
if (!client->groups[index]) {
|
if (!client->groups[index]) {
|
||||||
wl_client_post_no_memory(client->client);
|
wl_client_post_no_memory(client->client);
|
||||||
return;
|
return;
|
||||||
|
@ -228,15 +227,17 @@ static void add_tablet_pad_group(struct wlr_tablet_v2_tablet_pad *pad,
|
||||||
}
|
}
|
||||||
user_data->pad = client;
|
user_data->pad = client;
|
||||||
user_data->index = strip;
|
user_data->index = strip;
|
||||||
client->strips[strip] =
|
client->strips[strip] = wl_resource_create(client->client,
|
||||||
wl_resource_create(client->client, &zwp_tablet_pad_strip_v2_interface, 1, 0);
|
&zwp_tablet_pad_strip_v2_interface, version, 0);
|
||||||
if (!client->strips[strip]) {
|
if (!client->strips[strip]) {
|
||||||
|
free(user_data);
|
||||||
wl_client_post_no_memory(client->client);
|
wl_client_post_no_memory(client->client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(client->strips[strip],
|
wl_resource_set_implementation(client->strips[strip],
|
||||||
&tablet_pad_strip_impl, user_data, destroy_tablet_pad_strip_v2);
|
&tablet_pad_strip_impl, user_data, destroy_tablet_pad_strip_v2);
|
||||||
zwp_tablet_pad_group_v2_send_strip(client->groups[index], client->strips[strip]);
|
zwp_tablet_pad_group_v2_send_strip(client->groups[index],
|
||||||
|
client->strips[strip]);
|
||||||
}
|
}
|
||||||
|
|
||||||
client->ring_count = group->ring_count;
|
client->ring_count = group->ring_count;
|
||||||
|
@ -250,15 +251,17 @@ static void add_tablet_pad_group(struct wlr_tablet_v2_tablet_pad *pad,
|
||||||
}
|
}
|
||||||
user_data->pad = client;
|
user_data->pad = client;
|
||||||
user_data->index = ring;
|
user_data->index = ring;
|
||||||
client->rings[ring] =
|
client->rings[ring] = wl_resource_create(client->client,
|
||||||
wl_resource_create(client->client, &zwp_tablet_pad_ring_v2_interface, 1, 0);
|
&zwp_tablet_pad_ring_v2_interface, version, 0);
|
||||||
if (!client->rings[ring]) {
|
if (!client->rings[ring]) {
|
||||||
|
free(user_data);
|
||||||
wl_client_post_no_memory(client->client);
|
wl_client_post_no_memory(client->client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wl_resource_set_implementation(client->rings[ring],
|
wl_resource_set_implementation(client->rings[ring],
|
||||||
&tablet_pad_ring_impl, user_data, destroy_tablet_pad_ring_v2);
|
&tablet_pad_ring_impl, user_data, destroy_tablet_pad_ring_v2);
|
||||||
zwp_tablet_pad_group_v2_send_ring(client->groups[index], client->rings[ring]);
|
zwp_tablet_pad_group_v2_send_ring(client->groups[index],
|
||||||
|
client->rings[ring]);
|
||||||
}
|
}
|
||||||
|
|
||||||
zwp_tablet_pad_group_v2_send_done(client->groups[index]);
|
zwp_tablet_pad_group_v2_send_done(client->groups[index]);
|
||||||
|
|
Loading…
Reference in a new issue