about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-11-03 21:09:49 +0000
committerJames Booth <boothj5@gmail.com>2014-11-03 21:09:49 +0000
commit7a03dd7641d97a4f44bd78e82e7132213c88bd54 (patch)
tree529ee773674f10e0f2d9bed0c66b21ec8db7d348
parentc4ab9405f64b4faecde951cb4b575062b30e4f79 (diff)
downloadprofani-tty-7a03dd7641d97a4f44bd78e82e7132213c88bd54.tar.gz
Free datetime on ping errors
-rw-r--r--TODO_0453
-rw-r--r--src/xmpp/iq.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/TODO_045 b/TODO_045
index d98695a7..f370df2b 100644
--- a/TODO_045
+++ b/TODO_045
@@ -1,7 +1,4 @@
 Test with valgrind using new commands
-    /occupants
-    /privileges
-    /ping
     fix muc roster leak
 
 Update website help
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index 4717f6e7..353d771b 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -524,16 +524,17 @@ _manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza,
 {
     char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
     char *type = xmpp_stanza_get_type(stanza);
+    GDateTime *sent = (GDateTime *)userdata;
 
     // handle error responses
     if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
         char *error_message = stanza_get_error_message(stanza);
         handle_ping_error_result(from, error_message);
         free(error_message);
+        g_date_time_unref(sent);
         return 0;
     }
 
-    GDateTime *sent = (GDateTime *)userdata;
     GDateTime *now = g_date_time_new_now_local();
 
     GTimeSpan elapsed = g_date_time_difference(now, sent);