diff options
author | Drew DeVault <[email protected]> | 2016-12-17 13:23:44 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2016-12-17 13:23:44 -0500 |
commit | f04ee0e68d885d7e1101cc88f9a9337202041f1f (patch) | |
tree | fa4dc296a5f1377867752d320ceef4e4b0178bbf /sway/extensions.c | |
parent | 6c0fc2093641868df28c4087902a040f7fae05d4 (diff) | |
parent | d859f825d3612492678f5cd6cc6dc1f2647929e1 (diff) |
Merge pull request #995 from SirCmpwn/memory-use
Handle allocation failures
Diffstat (limited to 'sway/extensions.c')
-rw-r--r-- | sway/extensions.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sway/extensions.c b/sway/extensions.c index 96c7e60d..40702e28 100644 --- a/sway/extensions.c +++ b/sway/extensions.c @@ -23,6 +23,10 @@ static struct panel_config *find_or_create_panel_config(struct wl_resource *reso } sway_log(L_DEBUG, "Creating panel config for resource %p", resource); struct panel_config *config = calloc(1, sizeof(struct panel_config)); + if (!config) { + sway_log(L_ERROR, "Unable to create panel config"); + return NULL; + } list_add(desktop_shell.panels, config); config->wl_resource = resource; return config; @@ -81,6 +85,10 @@ static void set_background(struct wl_client *client, struct wl_resource *resourc } sway_log(L_DEBUG, "Setting surface %p as background for output %d", surface, (int)output); struct background_config *config = malloc(sizeof(struct background_config)); + if (!config) { + sway_log(L_ERROR, "Unable to allocate background config"); + return; + } config->client = client; config->output = output; config->surface = wlc_resource_from_wl_surface_resource(surface); |