dovecot-2.2: push-notification: Don't allocate cached metadata f...

dovecot at dovecot.org dovecot at dovecot.org
Fri Oct 2 09:12:26 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/5e667cce0842
changeset: 19273:5e667cce0842
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Oct 02 11:46:30 2015 +0300
description:
push-notification: Don't allocate cached metadata from memory pool in OX driver.
It slowly keeps increasing memory usage over time.

diffstat:

 src/plugins/push-notification/push-notification-driver-ox.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 012d11e9cb67 -r 5e667cce0842 src/plugins/push-notification/push-notification-driver-ox.c
--- a/src/plugins/push-notification/push-notification-driver-ox.c	Fri Oct 02 11:17:53 2015 +0300
+++ b/src/plugins/push-notification/push-notification-driver-ox.c	Fri Oct 02 11:46:30 2015 +0300
@@ -38,7 +38,7 @@
 /* This is data specific to an OX driver. */
 struct push_notification_driver_ox_config {
     struct http_url *http_url;
-    const char *cached_ox_metadata;
+    char *cached_ox_metadata;
     unsigned int cached_ox_metadata_lifetime;
     time_t cached_ox_metadata_timestamp;
     bool use_unsafe_username;
@@ -171,8 +171,8 @@
     if (!success)
 	    return NULL;
 
-    dconfig->cached_ox_metadata =
-        p_strdup(dtxn->ptxn->muser->pool, attr.value);
+    i_free(dconfig->cached_ox_metadata);
+    dconfig->cached_ox_metadata = i_strdup(attr.value);
     dconfig->cached_ox_metadata_timestamp = ioloop_time;
 
     return dconfig->cached_ox_metadata;
@@ -355,6 +355,9 @@
 static void push_notification_driver_ox_deinit
 (struct push_notification_driver_user *duser ATTR_UNUSED)
 {
+    struct push_notification_driver_ox_config *dconfig = duser->context;
+
+    i_free(dconfig->cached_ox_metadata);
     if (ox_global != NULL) {
         i_assert(ox_global->refcount > 0);
         --ox_global->refcount;


More information about the dovecot-cvs mailing list