From d91185d67b831ea5015b00a4721e209513f87fc7 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 17 Dec 2015 08:30:20 -0500 Subject: Fix null dereference in swaybar --- swaybar/main.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'swaybar') diff --git a/swaybar/main.c b/swaybar/main.c index d992b154..0a25d0f5 100644 --- a/swaybar/main.c +++ b/swaybar/main.c @@ -110,6 +110,10 @@ void ipc_update_workspaces() { uint32_t len = 0; char *res = ipc_single_command(socketfd, IPC_GET_WORKSPACES, NULL, &len); json_object *results = json_tokener_parse(res); + if (!results) { + free(res); + return; + } int i; for (i = 0; i < json_object_array_length(results); ++i) { -- cgit v1.2.3