aboutsummaryrefslogtreecommitdiff
path: root/swaybar/tray/host.c
diff options
context:
space:
mode:
authorIan Fan <ianfan0@gmail.com>2020-03-04 14:34:32 +0000
committerSimon Ser <contact@emersion.fr>2020-03-30 17:31:00 +0200
commit68f53cd509af8812562d743a55128a1b341247f5 (patch)
tree269042ba89e26b4124bb9f53cd9debf29e6f2599 /swaybar/tray/host.c
parent3b894c387dc38e8715186d5c0171b6048b36c435 (diff)
tray: tidy code
This includes some refactoring and fixing a small memory leak.
Diffstat (limited to 'swaybar/tray/host.c')
-rw-r--r--swaybar/tray/host.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/swaybar/tray/host.c b/swaybar/tray/host.c
index 451b0896..ddf2416d 100644
--- a/swaybar/tray/host.c
+++ b/swaybar/tray/host.c
@@ -65,9 +65,9 @@ static int handle_sni_unregistered(sd_bus_message *msg, void *data,
static int get_registered_snis_callback(sd_bus_message *msg, void *data,
sd_bus_error *error) {
if (sd_bus_message_is_method_error(msg, NULL)) {
- sd_bus_error err = *sd_bus_message_get_error(msg);
- sway_log(SWAY_ERROR, "Failed to get registered SNIs: %s", err.message);
- return -sd_bus_error_get_errno(&err);
+ const sd_bus_error *err = sd_bus_message_get_error(msg);
+ sway_log(SWAY_ERROR, "Failed to get registered SNIs: %s", err->message);
+ return -sd_bus_error_get_errno(err);
}
int ret = sd_bus_message_enter_container(msg, 'v', NULL);
@@ -87,9 +87,11 @@ static int get_registered_snis_callback(sd_bus_message *msg, void *data,
struct swaybar_tray *tray = data;
for (char **id = ids; *id; ++id) {
add_sni(tray, *id);
+ free(*id);
}
}
+ free(ids);
return ret;
}