]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap-hibernate: imap_hibernate_client_parse_input() - Reduce allocation from global...
authorMarco Bettini <marco.bettini@open-xchange.com>
Tue, 10 Jun 2025 09:27:05 +0000 (09:27 +0000)
committerMarco Bettini <marco.bettini@open-xchange.com>
Fri, 27 Jun 2025 13:54:52 +0000 (13:54 +0000)
Found by coverity, 40470 Resource leak

src/imap-hibernate/imap-client.c
src/imap-hibernate/imap-hibernate-client.c

index 5c11dd1ddedf1fa20633f8d9d49b86d7a88a68c2..99e06c7e9ceff806f03b57fede612dd124bd9439 100644 (file)
@@ -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);
index 309fe79bfb39f15ab2b472c51bd2898522a47711..b1c02db1880a1a14e2da807c4aa1632aa1e48d96 100644 (file)
@@ -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) {