# HG changeset patch # User Timo Sirainen # Date 1204789336 -7200 # Node ID 7d4f7c7095dd24caf45740baab7e890c0f2056c4 # Parent 25551453b13c4e0e8fd83f554c3d7b1d813e30ef imap_quote(): Don't crash if allocating from data stack pool. diff -r 25551453b13c -r 7d4f7c7095dd src/lib-imap/imap-quote.c --- a/src/lib-imap/imap-quote.c Thu Mar 06 02:08:44 2008 +0200 +++ b/src/lib-imap/imap-quote.c Thu Mar 06 09:42:16 2008 +0200 @@ -91,18 +91,20 @@ const char *imap_quote(pool_t pool, const unsigned char *value, size_t value_len) { + string_t *str; char *ret; if (value == NULL) return "NIL"; - T_BEGIN { - string_t *str; + if (!pool->datastack_pool) + t_push(); - str = t_str_new(value_len + MAX_INT_STRLEN + 5); - imap_quote_append(str, value, value_len, TRUE); - ret = p_strndup(pool, str_data(str), str_len(str)); - } T_END; + str = t_str_new(value_len + MAX_INT_STRLEN + 5); + imap_quote_append(str, value, value_len, TRUE); + ret = p_strndup(pool, str_data(str), str_len(str)); + if (!pool->datastack_pool) + t_pop(); return ret; }