From: JinWang An Date: Wed, 2 Dec 2020 08:12:16 +0000 (+0900) Subject: Fix to dereference NULL address of memory. X-Git-Tag: submit/tizen/20201203.013717^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F89%2F248789%2F3;p=platform%2Fcore%2Fapi%2Fbase-utils.git Fix to dereference NULL address of memory. Change-Id: Id6687a11b495c31f1f37b3b5f33671b8c7ff09c7 Signed-off-by: JinWang An --- diff --git a/i18ninfo/i18ninfo.cpp b/i18ninfo/i18ninfo.cpp index 874c451..72a6cac 100644 --- a/i18ninfo/i18ninfo.cpp +++ b/i18ninfo/i18ninfo.cpp @@ -1204,9 +1204,12 @@ i18n_uchar *_convert_unicode_numeric_values(const i18n_uchar *input, int32_t len if (length <= 0) return NULL; int32_t output_length = 1; - - double *values = (double *) malloc(length * sizeof(double)); int max_value_length = 0; + double *values = (double *) malloc(length * sizeof(double)); + if (NULL == values) { + fprintf(stderr, "\nError: Out of memory.\n", values); + return NULL; + } /* Count output length */ for (int32_t i = 0; i < length; ++i) {