aboutsummaryrefslogtreecommitdiffstats
path: root/interimap
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2016-03-12 03:32:27 +0100
committerGuilhem Moulin <guilhem@fripost.org>2016-03-12 03:32:27 +0100
commitc8376a4c8130f98a56fd65e370032c27234ed323 (patch)
tree84798e52f4e29c3a1c23894d70ac0e8e02c315ad /interimap
parent93d2e96fde87cbeb1c32ea556c0b4d3591ec41ba (diff)
interimap: fix memory leak.
Diffstat (limited to 'interimap')
-rwxr-xr-xinterimap10
1 files changed, 5 insertions, 5 deletions
diff --git a/interimap b/interimap
index 7097f17..dc1be99 100755
--- a/interimap
+++ b/interimap
@@ -426,9 +426,8 @@ elsif (defined $COMMAND and $COMMAND eq 'rename') {
##############################################################################
# Synchronize mailbox and subscription lists
-my @MAILBOXES;
sub sync_mailbox_list() {
- my %mailboxes;
+ my (%mailboxes, @mailboxes);
$mailboxes{$_} = 1 foreach keys %{$IMAP->{local}->{mailboxes}};
$mailboxes{$_} = 1 foreach keys %{$IMAP->{remote}->{mailboxes}};
my $sth_subscribe = $DBH->prepare(q{UPDATE mailboxes SET subscribed = ? WHERE idx = ?});
@@ -445,7 +444,7 @@ sub sync_mailbox_list() {
};
check_delim($mailbox); # ensure that the delimiter match
- push @MAILBOXES, $mailbox unless grep {lc $_ eq lc '\NoSelect'} @attrs;
+ push @mailboxes, $mailbox unless grep {lc $_ eq lc '\NoSelect'} @attrs;
$STH_GET_INDEX->execute($mailbox);
my ($idx,$subscribed) = $STH_GET_INDEX->fetchrow_array();
@@ -513,9 +512,10 @@ sub sync_mailbox_list() {
$DBH->commit();
}
}
+ return @mailboxes;
}
-sync_mailbox_list();
+my @MAILBOXES = sync_mailbox_list();
($lIMAP, $rIMAP) = map {$IMAP->{$_}->{client}} qw/local remote/;
my $ATTRS = join ' ', qw/MODSEQ FLAGS INTERNALDATE BODY.PEEK[]/;
@@ -1222,7 +1222,7 @@ while(1) {
sleep $CONFIG{watch};
# Refresh the mailbox list and status
@{$IMAP->{$_}}{qw/mailboxes delims/} = $IMAP->{$_}->{client}->list($LIST, @LIST_PARAMS) for qw/local remote/;
- sync_mailbox_list();
+ @MAILBOXES = sync_mailbox_list();
}
END { cleanup(); }