From 990894495ec691135a4f142703440094a2f1271a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Mon, 22 Aug 2022 20:38:59 +0300 Subject: [PATCH] Replace xzfree() with free() when the former has no added value. That is, when a new value is assigned to the parameter on the next line. In strarray_fini() the data is never read again, so there is need to zero it. --- imap/mailbox.c | 12 ++++++------ imap/mboxlist.c | 4 ++-- imap/reconstruct.c | 6 +++--- imap/sync_client.c | 2 +- lib/strarray.c | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/imap/mailbox.c b/imap/mailbox.c index 3aea223ec1..1f6ac4a6e0 100644 --- a/imap/mailbox.c +++ b/imap/mailbox.c @@ -1375,7 +1375,7 @@ static int parseentry_cb(int type, struct dlistsax_data *d) break; case DLISTSAX_KVLISTEND: if (rock->doingacl) { - xzfree(rock->h->acl); + free(rock->h->acl); rock->h->acl = buf_release(&rock->aclbuf); rock->doingacl = 0; } @@ -1404,23 +1404,23 @@ static int parseentry_cb(int type, struct dlistsax_data *d) buf_putc(&rock->aclbuf, '\t'); } else if (rock->doingflags) { - xzfree(rock->h->flagname[rock->nflags]); + free(rock->h->flagname[rock->nflags]); rock->h->flagname[rock->nflags++] = xstrdupnull(d->data); } else { if (!strcmp(key, "I")) { - xzfree(rock->h->uniqueid); + free(rock->h->uniqueid); rock->h->uniqueid = xstrdupnull(d->data); } else if (!strcmp(key, "N")) { - xzfree(rock->h->name); + free(rock->h->name); rock->h->name = xstrdupnull(d->data); } else if (!strcmp(key, "T")) { rock->h->mbtype = mboxlist_string_to_mbtype(d->data); } else if (!strcmp(key, "Q")) { - xzfree(rock->h->quotaroot); + free(rock->h->quotaroot); rock->h->quotaroot = xstrdupnull(d->data); } } @@ -6583,7 +6583,7 @@ HIDDEN int mailbox_rename_nocopy(struct mailbox *oldmailbox, if (!silent) mailbox_modseq_dirty(oldmailbox); /* update the name in the header */ - xzfree(oldmailbox->h.name); + free(oldmailbox->h.name); oldmailbox->h.name = xstrdup(newname); oldmailbox->header_dirty = 1; diff --git a/imap/mboxlist.c b/imap/mboxlist.c index ce7cb1c375..871eb35851 100644 --- a/imap/mboxlist.c +++ b/imap/mboxlist.c @@ -1794,7 +1794,7 @@ EXPORTED int mboxlist_promote_intermediary(const char *mboxname) &mbentry->partition); if (r) goto done; mbentry->mbtype &= ~MBTYPE_INTERMEDIATE; - xzfree(mbentry->acl); + free(mbentry->acl); mbentry->acl = xstrdupnull(parent->acl); r = mailbox_create(mboxname, mbentry->mbtype, @@ -1809,7 +1809,7 @@ EXPORTED int mboxlist_promote_intermediary(const char *mboxname) if (r) goto done; // make sure all the fields are up-to-date - xzfree(mbentry->uniqueid); + free(mbentry->uniqueid); mbentry->uniqueid = xstrdupnull(mailbox_uniqueid(mailbox)); mbentry->uidvalidity = mailbox->i.uidvalidity; mbentry->createdmodseq = mailbox->i.createdmodseq; diff --git a/imap/reconstruct.c b/imap/reconstruct.c index eb7b86cf36..21b572a5f7 100644 --- a/imap/reconstruct.c +++ b/imap/reconstruct.c @@ -554,7 +554,7 @@ static int do_reconstruct(struct findall_data *data, void *rock) if (strcmpsafe(mailbox_uniqueid(mailbox), mbentry_byname->uniqueid)) { printf("Wrong uniqueid in mbentry, fixing %s (%s -> %s)\n", name, mbentry_byname->uniqueid, mailbox_uniqueid(mailbox)); - xzfree(mbentry_byname->uniqueid); + free(mbentry_byname->uniqueid); mbentry_byname->uniqueid = xstrdupnull(mailbox_uniqueid(mailbox)); mbentry_dirty = 1; } @@ -574,7 +574,7 @@ static int do_reconstruct(struct findall_data *data, void *rock) printf("Wrong uniqueid! %s (should be %s)\n", mbentry_byid->name, name); if (updateuniqueids) { mailbox_make_uniqueid(mailbox); - xzfree(mbentry_byname->uniqueid); + free(mbentry_byname->uniqueid); mbentry_byname->uniqueid = xstrdupnull(mailbox_uniqueid(mailbox)); mbentry_dirty = 1; syslog (LOG_ERR, "uniqueid clash with %s - changed %s (%s => %s)", @@ -641,7 +641,7 @@ static int do_reconstruct(struct findall_data *data, void *rock) else { printf("Wrong acl in mbentry %s (%s %s)\n", name, mbentry_byname->acl, mailbox_acl(mailbox)); - xzfree(mbentry_byname->acl); + free(mbentry_byname->acl); mbentry_byname->acl = xstrdupnull(mailbox_acl(mailbox)); mbentry_dirty = 1; } diff --git a/imap/sync_client.c b/imap/sync_client.c index 94a0eaec19..c0689da37f 100644 --- a/imap/sync_client.c +++ b/imap/sync_client.c @@ -387,7 +387,7 @@ static int cb_allmbox(const mbentry_t *mbentry, void *rock) if (!strcmpsafe(userid, prev_userid)) goto done; - xzfree(prev_userid); + free(prev_userid); prev_userid = xstrdup(userid); r = sync_do_user(&sync_cs, userid, NULL); diff --git a/lib/strarray.c b/lib/strarray.c index 81e19c15f9..1cc1d872f2 100644 --- a/lib/strarray.c +++ b/lib/strarray.c @@ -60,7 +60,7 @@ EXPORTED void strarray_fini(strarray_t *sa) if (!sa) return; for (i = 0 ; i < sa->count ; i++) { - xzfree(sa->data[i]); + free(sa->data[i]); } xzfree(sa->data); sa->count = 0;