Skip to content

Commit

Permalink
relocate_by_id.c:main() memory leaks with oldpaths and newpaths
Browse files Browse the repository at this point in the history
  • Loading branch information
dilyanpalauzov committed Aug 18, 2023
1 parent bb6a880 commit 975f97a
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions imap/relocate_by_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,15 @@ int main(int argc, char **argv)
/* Process each mailbox in reverse order (children first) */
struct buf part_buf = BUF_INITIALIZER;
while ((mbentry = ptrarray_pop(mboxlist_rock.mboxlist))) {
if (r) {
mboxlist_entry_free(&mbentry);
continue;
}
const char *partition = mbentry->partition;
const char *uniqueid = mbentry->uniqueid;
const char *name = mbentry->name;
const char *path = NULL;
char *userid = NULL;
char *extname = NULL;
strarray_t *oldpaths = strarray_new();
strarray_t *newpaths = strarray_new();
strarray_t *subs = NULL;
Expand All @@ -219,17 +222,11 @@ int main(int argc, char **argv)
const char *, unsigned long) =
{ &mboxname_datapath, &mboxname_archivepath, NULL };

if (r) {
mboxlist_entry_free(&mbentry);
continue;
}

extname = mboxname_to_external(mbentry->name, &reloc_namespace, NULL);
char *extname = mboxname_to_external(mbentry->name, &reloc_namespace, NULL);

if (!quiet) printf("\nRelocating: %s\n", extname);

struct mboxlock *namespacelock = NULL;
namespacelock = mboxname_usernamespacelock(mbentry->name);
struct mboxlock *namespacelock = mboxname_usernamespacelock(mbentry->name);
if (!namespacelock) {
fprintf(stderr,
"Failed to create namespacelock for %s: %s\n",
Expand Down

0 comments on commit 975f97a

Please sign in to comment.