From e73b18504b0f9c5d9ee5ac92275c8160c613b265 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Mon, 4 Mar 2024 10:49:47 +0900 Subject: [PATCH] Fix svace : Assert when malloc matrix failed It is possible to fail malloc memory. Let we notify this case. Change-Id: Ice13e4f5a845f28d947fb9f0edff002e1b4b1c89 Signed-off-by: Eunki, Hong --- dali/internal/common/matrix-utils.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dali/internal/common/matrix-utils.cpp b/dali/internal/common/matrix-utils.cpp index 6ad3d7d..5ee80d1 100644 --- a/dali/internal/common/matrix-utils.cpp +++ b/dali/internal/common/matrix-utils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -438,6 +438,7 @@ void MultiplyAssign(Dali::Matrix& result, const Dali::Matrix& rhs) { // If rhs is same matrix with result, we need to copy temperal vaules. temp = static_cast(malloc(NUM_BYTES_IN_MATRIX)); + DALI_ASSERT_ALWAYS(temp && "malloc is failed."); memcpy(temp, rhsPtr, NUM_BYTES_IN_MATRIX); rhsPtr = temp; } @@ -571,6 +572,7 @@ void MultiplyAssign(Dali::Matrix3& result, const Dali::Matrix3& rhs) { // If rhs is same matrix with result, we need to copy temperal vaules. temp = static_cast(malloc(NUM_BYTES_IN_MATRIX3)); + DALI_ASSERT_ALWAYS(temp && "malloc is failed."); memcpy(temp, rhsPtr, NUM_BYTES_IN_MATRIX3); rhsPtr = temp; } -- 2.7.4