From 87735ccbf2a9defdc61ac429a3c8decb425d2ecb Mon Sep 17 00:00:00 2001 From: Pavel Charvat Date: Thu, 11 Nov 2021 10:42:49 +0000 Subject: [PATCH] Trans: Duplicate exception ids to transaction pool. Otherwise it breaks after longjmp if allocated on stack, for example in bthrow(). --- ucw/trans.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.39.2