diff options
author | Calvin Lee <cyrus296@gmail.com> | 2017-07-16 17:59:16 -0700 |
---|---|---|
committer | Calvin Lee <cyrus296@gmail.com> | 2017-07-16 19:06:24 -0700 |
commit | e8f589c3dcb11b8f2aa778380381715b680a5ec8 (patch) | |
tree | 78a234d41e62b21f65fe1026db8d005ba36aa864 /swaybar/tray | |
parent | Merge pull request #1279 from 4e554c4c/bad_items (diff) | |
download | sway-e8f589c3dcb11b8f2aa778380381715b680a5ec8.tar.gz sway-e8f589c3dcb11b8f2aa778380381715b680a5ec8.tar.zst sway-e8f589c3dcb11b8f2aa778380381715b680a5ec8.zip |
Fix memory leaks in swaybar tray
Diffstat (limited to 'swaybar/tray')
-rw-r--r-- | swaybar/tray/dbus.c | 4 | ||||
-rw-r--r-- | swaybar/tray/sni.c | 4 | ||||
-rw-r--r-- | swaybar/tray/tray.c | 1 |
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) { | |||
108 | 108 | ||
109 | timer_settime(*timer, 0, &time, NULL); | 109 | timer_settime(*timer, 0, &time, NULL); |
110 | 110 | ||
111 | dbus_timeout_set_data(timeout, timer, free); | 111 | dbus_timeout_set_data(timeout, timer, NULL); |
112 | 112 | ||
113 | sway_log(L_DEBUG, "Adding DBus timeout. Interval: %ds %dms", interval_sec, interval_msec); | 113 | sway_log(L_DEBUG, "Adding DBus timeout. Interval: %ds %dms", interval_sec, interval_msec); |
114 | add_timer(*timer, dispatch_timeout, timeout); | 114 | add_timer(*timer, dispatch_timeout, timeout); |
@@ -121,6 +121,8 @@ static void remove_timeout(DBusTimeout *timeout, void *_data) { | |||
121 | 121 | ||
122 | if (timer) { | 122 | if (timer) { |
123 | remove_timer(*timer); | 123 | remove_timer(*timer); |
124 | timer_delete(*timer); | ||
125 | free(timer); | ||
124 | } | 126 | } |
125 | } | 127 | } |
126 | 128 | ||
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) { | |||
160 | dirty = true; | 160 | dirty = true; |
161 | 161 | ||
162 | dbus_message_unref(reply); | 162 | dbus_message_unref(reply); |
163 | dbus_pending_call_unref(pending); | ||
163 | return; | 164 | return; |
164 | } else { | 165 | } else { |
165 | sway_log(L_ERROR, "Could not create image surface"); | 166 | sway_log(L_ERROR, "Could not create image surface"); |
@@ -170,6 +171,7 @@ bail: | |||
170 | if (reply) { | 171 | if (reply) { |
171 | dbus_message_unref(reply); | 172 | dbus_message_unref(reply); |
172 | } | 173 | } |
174 | dbus_pending_call_unref(pending); | ||
173 | sway_log(L_ERROR, "Could not get icon from item"); | 175 | sway_log(L_ERROR, "Could not get icon from item"); |
174 | return; | 176 | return; |
175 | } | 177 | } |
@@ -266,6 +268,7 @@ static void reply_icon_name(DBusPendingCall *pending, void *_data) { | |||
266 | dirty = true; | 268 | dirty = true; |
267 | 269 | ||
268 | dbus_message_unref(reply); | 270 | dbus_message_unref(reply); |
271 | dbus_pending_call_unref(pending); | ||
269 | return; | 272 | return; |
270 | } | 273 | } |
271 | 274 | ||
@@ -273,6 +276,7 @@ bail: | |||
273 | if (reply) { | 276 | if (reply) { |
274 | dbus_message_unref(reply); | 277 | dbus_message_unref(reply); |
275 | } | 278 | } |
279 | dbus_pending_call_unref(pending); | ||
276 | // Now try the pixmap | 280 | // Now try the pixmap |
277 | send_icon_msg(item); | 281 | send_icon_msg(item); |
278 | return; | 282 | 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) { | |||
99 | 99 | ||
100 | bail: | 100 | bail: |
101 | dbus_message_unref(reply); | 101 | dbus_message_unref(reply); |
102 | dbus_pending_call_unref(pending); | ||
102 | return; | 103 | return; |
103 | } | 104 | } |
104 | static void get_items() { | 105 | static void get_items() { |