diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-06-25 11:51:40 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-06-25 14:28:58 +0200 |
commit | 77f7ec51521531bc84b4d9dc9bb6767c9f2aeb39 (patch) | |
tree | 5327692c345c74b212d9d66b9c893d82c7a2a416 /ext/intl/msgformat/msgformat_helpers.cpp | |
parent | c7962207d7b4c1c0449c24338538a474c6f9dc13 (diff) | |
download | php-git-77f7ec51521531bc84b4d9dc9bb6767c9f2aeb39.tar.gz |
Fix TimeZone leak in intl MessageFormat
I'm just giving each format a distinct owned object here ... sharing
it looks complicated.
Diffstat (limited to 'ext/intl/msgformat/msgformat_helpers.cpp')
-rw-r--r-- | ext/intl/msgformat/msgformat_helpers.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index dcc74283b2..ed75ae8bf6 100644 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -343,20 +343,24 @@ static void umsg_set_timezone(MessageFormatter_object *mfo, } if (used_tz == NULL) { - zval nullzv, *zvptr = &nullzv; - ZVAL_NULL(zvptr); - used_tz = timezone_process_timezone_argument(zvptr, &err, "msgfmt_format"); + zval nullzv; + ZVAL_NULL(&nullzv); + used_tz = timezone_process_timezone_argument(&nullzv, &err, "msgfmt_format"); if (used_tz == NULL) { continue; } } - df->setTimeZone(*used_tz); + df->adoptTimeZone(used_tz->clone()); } if (U_SUCCESS(err.code)) { mfo->mf_data.tz_set = 1; } + + if (used_tz) { + delete used_tz; + } } U_CFUNC void umsg_format_helper(MessageFormatter_object *mfo, |