Merge pull request #914 from emersion/misc-segfault-fixes

Misc segfault fixes
This commit is contained in:
Drew DeVault 2018-04-26 17:37:27 +02:00 committed by GitHub
commit 979b1b22d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View file

@ -340,7 +340,7 @@ static void layer_shell_handle_get_layer_surface(struct wl_client *wl_client,
surface->layer = layer; surface->layer = layer;
if (layer > ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY) { if (layer > ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY) {
free(surface); free(surface);
wl_resource_post_error(surface->resource, wl_resource_post_error(client_resource,
ZWLR_LAYER_SHELL_V1_ERROR_INVALID_LAYER, ZWLR_LAYER_SHELL_V1_ERROR_INVALID_LAYER,
"Invalid layer %d", layer); "Invalid layer %d", layer);
return; return;

View file

@ -399,7 +399,7 @@ static const struct xdg_positioner_interface
static void xdg_shell_handle_create_positioner(struct wl_client *wl_client, static void xdg_shell_handle_create_positioner(struct wl_client *wl_client,
struct wl_resource *resource, uint32_t id) { struct wl_resource *resource, uint32_t id) {
struct wlr_xdg_positioner *positioner = struct wlr_xdg_positioner *positioner =
calloc(1, sizeof(struct wlr_xdg_positioner_resource)); calloc(1, sizeof(struct wlr_xdg_positioner));
if (positioner == NULL) { if (positioner == NULL) {
wl_client_post_no_memory(wl_client); wl_client_post_no_memory(wl_client);
return; return;

View file

@ -309,6 +309,7 @@ static bool source_get_targets(struct wlr_xwm_selection *selection,
char **mime_type_ptr = char **mime_type_ptr =
wl_array_add(mime_types, sizeof(*mime_type_ptr)); wl_array_add(mime_types, sizeof(*mime_type_ptr));
if (mime_type_ptr == NULL) { if (mime_type_ptr == NULL) {
free(mime_type);
break; break;
} }
*mime_type_ptr = mime_type; *mime_type_ptr = mime_type;