From: Pavel Charvat Date: Thu, 11 Nov 2021 10:42:49 +0000 (+0000) Subject: Trans: Duplicate exception ids to transaction pool. X-Git-Tag: v6.5.13~1 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=87735ccbf2a9defdc61ac429a3c8decb425d2ecb;p=libucw.git Trans: Duplicate exception ids to transaction pool. Otherwise it breaks after longjmp if allocated on stack, for example in bthrow(). --- diff --git a/ucw/trans.c b/ucw/trans.c index db883837..8c39c15b 100644 --- a/ucw/trans.c +++ b/ucw/trans.c @@ -2,6 +2,7 @@ * The UCW Library -- Transactions * * (c) 2008--2011 Martin Mares + * (c) 2021 Pavel Charvat * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -201,7 +202,7 @@ trans_vthrow(const char *id, void *object, const char *fmt, va_list args) if (!mp) vdie(fmt, args); struct exception *x = mp_alloc(mp, sizeof(*x)); - x->id = id; + x->id = mp_strdup(mp, id); x->object = object; x->msg = mp_vprintf(mp, fmt, args); trans_throw_exc(x);