From 598507145d7d7de4cf4e1408b9d16ef14fa42805 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 12 Jun 2017 06:54:41 -0700 Subject: lib: reimplement chk_wmalloc using chk_xalloc. * lib.c (chk_wmalloc): Drop the incorrect multiplication overflow test, and just call chk_xalloc. --- lib.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib.c b/lib.c index 06dc76ff..f096045c 100644 --- a/lib.c +++ b/lib.c @@ -2655,10 +2655,8 @@ mem_t *chk_manage_vec(mem_t *old, size_t oldfilled, size_t newfilled, wchar_t *chk_wmalloc(size_t nwchar) { - size_t size = nwchar * sizeof (wchar_t); - if (size < nwchar) - uw_throw(error_s, lit("string size overflow")); - return coerce(wchar_t *, chk_malloc(sizeof (wchar_t) * nwchar)); + return coerce(wchar_t *, chk_xalloc(nwchar, sizeof (wchar_t), + lit("string operation"))); } wchar_t *chk_strdup(const wchar_t *str) -- cgit v1.2.3