From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Date: Sat, 2 Apr 2022 09:46:59 +0000 (+0200)
Subject: lib: simplify u16_strdup()
X-Git-Tag: v2025.01-rc5-pxa1908~1453^2~2
X-Git-Url: http://git.dujemihanovic.xyz/img/html/static/%7B%7B%20%28.OutputFormats.Get?a=commitdiff_plain;h=967407defe8b79bd464984801614373f4ab2f6f9;p=u-boot.git

lib: simplify u16_strdup()

Use u16_strsize() instead of duplicating it.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---

diff --git a/lib/charset.c b/lib/charset.c
index 91cbe87509..de201cf3b9 100644
--- a/lib/charset.c
+++ b/lib/charset.c
@@ -407,7 +407,7 @@ u16 *u16_strdup(const void *src)
 
 	if (!src)
 		return NULL;
-	len = (u16_strlen(src) + 1) * sizeof(u16);
+	len = u16_strsize(src);
 	new = malloc(len);
 	if (!new)
 		return NULL;