summaryrefslogtreecommitdiffstats
path: root/imap
diff options
context:
space:
mode:
authorSam Varshavchik2022-01-28 22:28:51 -0500
committerSam Varshavchik2022-01-28 22:28:51 -0500
commit45d2b388ab539af1fe9390fdce3490939b1222e9 (patch)
treedc70b4cea616149bf62ab7dc5f4a7c838eda9c63 /imap
parent58d76526d480e25c0c738f28b32342bcd803a85b (diff)
downloadcourier-libs-45d2b388ab539af1fe9390fdce3490939b1222e9.tar.bz2
Fix minor memory leaks
Diffstat (limited to 'imap')
-rw-r--r--imap/smap.c9
-rw-r--r--imap/smapsnapshot.c9
-rw-r--r--imap/smaptestsuite16
-rw-r--r--imap/smaptestsuite.txt24
4 files changed, 55 insertions, 3 deletions
diff --git a/imap/smap.c b/imap/smap.c
index bebf5d0..450e2dc 100644
--- a/imap/smap.c
+++ b/imap/smap.c
@@ -687,6 +687,7 @@ static void do_listcmd(struct list_hier **head,
}
maildir_aclt_list_destroy(&aclt_list);
+ maildir_info_destroy(&minfo);
}
else
{
@@ -3141,6 +3142,7 @@ static int dosetdeleteacl(void *cb_arg, int dodelete)
maildir_aclt_list_destroy(&aclt_list);
return 0;
}
+ free(path);
cnt=0;
maildir_aclt_list_enum(&aclt_list,
@@ -3905,6 +3907,8 @@ void smap()
if (maildir_info_smap_find(&minfo, fn,
getenv("AUTHENTICATED")) == 0)
{
+ maildir_smapfn_free(fn);
+
if (minfo.homedir && minfo.maildir)
{
maildir_aclt_list list;
@@ -3938,6 +3942,7 @@ void smap()
{
if (q)
free(q);
+ maildir_aclt_list_destroy(&list);
maildir_info_destroy(&minfo);
accessdenied(ACL_DELETEFOLDER);
continue;
@@ -3949,6 +3954,10 @@ void smap()
}
maildir_info_destroy(&minfo);
}
+ else
+ {
+ maildir_smapfn_free(fn);
+ }
}
if (t && current_mailbox &&
diff --git a/imap/smapsnapshot.c b/imap/smapsnapshot.c
index 805fd07..6ffc226 100644
--- a/imap/smapsnapshot.c
+++ b/imap/smapsnapshot.c
@@ -145,6 +145,7 @@ static void delete_snapshot(struct snapshot_list *snn)
{
strcat(strcat(strcpy(p, snapshot_dir), "/"), snn->filename);
unlink(p);
+ free(p);
}
free(snn->filename);
@@ -621,6 +622,14 @@ int snapshot_init(const char *folder, const char *snapshot)
--cnt;
}
+ while (sl)
+ {
+ snn=sl;
+ sl=sl->next;
+ free(snn->filename);
+ free(snn->prev);
+ free(snn);
+ }
return rc;
}
diff --git a/imap/smaptestsuite b/imap/smaptestsuite
index 4962027..2ea5849 100644
--- a/imap/smaptestsuite
+++ b/imap/smaptestsuite
@@ -661,8 +661,22 @@ test message
EOF
n=`expr $n + 1`
done
-env AUTHENTICATED=confmdtest IMAP_BROKENUIDV=1 IMAP_KEYWORDS=1 MOVE_EXPUNGE_TO_TRASH=1 MAILDIR=confmdtest PROTOCOL=SMAP1 $IMAPINVOKE <<EOF | sed "$SED"
+env AUTHENTICATED=user1 IMAP_BROKENUIDV=1 IMAP_KEYWORDS=1 MOVE_EXPUNGE_TO_TRASH=1 MAILDIR=confmdtest PROTOCOL=SMAP1 $IMAPINVOKE <<EOF | sed "$SED"
OPEN INBOX
EXPUNGE
+SETACL INBOX "" -owner c
+MKDIR INBOX subdir
+CREATE INBOX subdir
+SETACL INBOX "" -owner ""
+MKDIR INBOX subdir
+CREATE INBOX subdir
+SETACL INBOX "" -owner x
+RMDIR INBOX subdir
+SETACL INBOX "" -owner ""
+RMDIR INBOX subdir
+SETACL INBOX subdir "" -owner x
+DELETE INBOX subdir
+SETACL INBOX subdir "" -owner ""
+DELETE INBOX subdir
LOGOUT
EOF
diff --git a/imap/smaptestsuite.txt b/imap/smaptestsuite.txt
index b4bc2c0..4ce6aa8 100644
--- a/imap/smaptestsuite.txt
+++ b/imap/smaptestsuite.txt
@@ -2059,5 +2059,25 @@
002053 * EXPUNGE 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 142 144 146 148 150 152 154 156 158 160 162 164 166 168 170 172 174 176 178 180 182 184 186 188 190 192 194 196 198 200 202
002054 * EXPUNGE 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155
002055 +OK Folder updated
-002056 * BYE Courier-SMAP server shutting down
-002057 +OK LOGOUT completed
+002056 * GETACL "owner" "aceilrstwx" "administrators" "aceilrstwx" "-owner" "c"
+002057 +OK Updated ACLs
+002058 -ERR --error--
+002059 -ERR --error--
+002060 * GETACL "owner" "aceilrstwx" "administrators" "aceilrstwx"
+002061 +OK Updated ACLs
+002062 +OK Folder created
+002063 +OK Folder created
+002064 * GETACL "owner" "aceilrstwx" "administrators" "aceilrstwx" "-owner" "x"
+002065 +OK Updated ACLs
+002066 -ERR --error--
+002067 * GETACL "owner" "aceilrstwx" "administrators" "aceilrstwx"
+002068 +OK Updated ACLs
+002069 +OK Folder deleted
+002070 * GETACL "owner" "aceilrstwx" "administrators" "aceilrstwx" "-owner" "x"
+002071 +OK Updated ACLs
+002072 -ERR --error--
+002073 * GETACL "owner" "aceilrstwx" "administrators" "aceilrstwx"
+002074 +OK Updated ACLs
+002075 +OK Folder deleted
+002076 * BYE Courier-SMAP server shutting down
+002077 +OK LOGOUT completed