From: Marco Bettini Date: Tue, 10 Jun 2025 09:27:05 +0000 (+0000) Subject: imap-hibernate: imap_hibernate_client_parse_input() - Reduce allocation from global... X-Git-Tag: 2.4.2~699 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0521b2e5a96f7d2de8720fa276a533a84555b55b;p=thirdparty%2Fdovecot%2Fcore.git imap-hibernate: imap_hibernate_client_parse_input() - Reduce allocation from global to temp for state_r->tag Found by coverity, 40470 Resource leak --- diff --git a/src/imap-hibernate/imap-client.c b/src/imap-hibernate/imap-client.c index 5c11dd1dde..99e06c7e9c 100644 --- a/src/imap-hibernate/imap-client.c +++ b/src/imap-hibernate/imap-client.c @@ -643,6 +643,7 @@ imap_client_create(int fd, const struct imap_client_state *state) client->state.session_id = p_strdup(pool, state->session_id); client->state.userdb_fields = p_strdup(pool, state->userdb_fields); client->state.stats = p_strdup(pool, state->stats); + client->state.tag = i_strdup(state->tag); client->event = event_create(NULL); event_add_category(client->event, &event_category_imap_hibernate); diff --git a/src/imap-hibernate/imap-hibernate-client.c b/src/imap-hibernate/imap-hibernate-client.c index 309fe79bfb..b1c02db188 100644 --- a/src/imap-hibernate/imap-hibernate-client.c +++ b/src/imap-hibernate/imap-hibernate-client.c @@ -148,7 +148,7 @@ imap_hibernate_client_parse_input(const char *const *args, pool_t pool, return -1; } } else if (strcmp(key, "tag") == 0) { - state_r->tag = i_strdup(value); + state_r->tag = t_strdup_noconst(value); } else if (strcmp(key, "multiplex_ostream") == 0) { state_r->multiplex_ostream = TRUE; } else if (strcmp(key, "state") == 0) {