aboutsummaryrefslogtreecommitdiff
path: root/swaybar/tray
diff options
context:
space:
mode:
authorCalvin Lee <cyrus296@gmail.com>2017-07-16 17:59:16 -0700
committerCalvin Lee <cyrus296@gmail.com>2017-07-16 19:06:24 -0700
commite8f589c3dcb11b8f2aa778380381715b680a5ec8 (patch)
tree78a234d41e62b21f65fe1026db8d005ba36aa864 /swaybar/tray
parent5675a42def79ee8c2bbac32947034f1403aba4f6 (diff)
Fix memory leaks in swaybar tray
Diffstat (limited to 'swaybar/tray')
-rw-r--r--swaybar/tray/dbus.c4
-rw-r--r--swaybar/tray/sni.c4
-rw-r--r--swaybar/tray/tray.c1
3 files changed, 8 insertions, 1 deletions
diff --git a/swaybar/tray/dbus.c b/swaybar/tray/dbus.c
index 2a8cefc7..f562baeb 100644
--- a/swaybar/tray/dbus.c
+++ b/swaybar/tray/dbus.c
@@ -108,7 +108,7 @@ static dbus_bool_t add_timeout(DBusTimeout *timeout, void *_data) {
timer_settime(*timer, 0, &time, NULL);
- dbus_timeout_set_data(timeout, timer, free);
+ dbus_timeout_set_data(timeout, timer, NULL);
sway_log(L_DEBUG, "Adding DBus timeout. Interval: %ds %dms", interval_sec, interval_msec);
add_timer(*timer, dispatch_timeout, timeout);
@@ -121,6 +121,8 @@ static void remove_timeout(DBusTimeout *timeout, void *_data) {
if (timer) {
remove_timer(*timer);
+ timer_delete(*timer);
+ free(timer);
}
}
diff --git a/swaybar/tray/sni.c b/swaybar/tray/sni.c
index d9a5ca80..c9d00657 100644
--- a/swaybar/tray/sni.c
+++ b/swaybar/tray/sni.c
@@ -160,6 +160,7 @@ static void reply_icon(DBusPendingCall *pending, void *_data) {
dirty = true;
dbus_message_unref(reply);
+ dbus_pending_call_unref(pending);
return;
} else {
sway_log(L_ERROR, "Could not create image surface");
@@ -170,6 +171,7 @@ bail:
if (reply) {
dbus_message_unref(reply);
}
+ dbus_pending_call_unref(pending);
sway_log(L_ERROR, "Could not get icon from item");
return;
}
@@ -266,6 +268,7 @@ static void reply_icon_name(DBusPendingCall *pending, void *_data) {
dirty = true;
dbus_message_unref(reply);
+ dbus_pending_call_unref(pending);
return;
}
@@ -273,6 +276,7 @@ bail:
if (reply) {
dbus_message_unref(reply);
}
+ dbus_pending_call_unref(pending);
// Now try the pixmap
send_icon_msg(item);
return;
diff --git a/swaybar/tray/tray.c b/swaybar/tray/tray.c
index c1d8dde4..91c3af06 100644
--- a/swaybar/tray/tray.c
+++ b/swaybar/tray/tray.c
@@ -99,6 +99,7 @@ static void get_items_reply(DBusPendingCall *pending, void *_data) {
bail:
dbus_message_unref(reply);
+ dbus_pending_call_unref(pending);
return;
}
static void get_items() {