Skip to content

Commit

Permalink
index.c: free charset after use in SCAN command
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Stepanek <[email protected]>
  • Loading branch information
rsto committed Aug 2, 2023
1 parent dd3a777 commit b9ff8de
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions imap/index.c
Original file line number Diff line number Diff line change
Expand Up @@ -1760,19 +1760,21 @@ static int index_scan_work(const char *s, unsigned long len,
*/
EXPORTED int index_scan(struct index_state *state, const char *contents)
{
unsigned *msgno_list;
unsigned *msgno_list = NULL;
uint32_t msgno;
int n = 0;
int listindex;
int listcount;
struct searchargs searchargs;
struct searchargs searchargs = {0};
unsigned long length;
struct mailbox *mailbox = state->mailbox;
charset_t ascii = charset_lookupname("US-ASCII");

if (!(contents && contents[0])) return(0);
if (!(contents && contents[0]))
goto done;

if (state->exists <= 0) return 0;
if (state->exists <= 0)
goto done;

length = strlen(contents);

Expand Down Expand Up @@ -1808,6 +1810,7 @@ EXPORTED int index_scan(struct index_state *state, const char *contents)
buf_free(&buf);
}

done:
charset_free(&ascii);
search_expr_free(searchargs.root);
free(msgno_list);
Expand Down

0 comments on commit b9ff8de

Please sign in to comment.