]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Delay get_iconv_handle() in strchr_m()
authorVolker Lendecke <vl@samba.org>
Tue, 6 Jan 2026 15:29:30 +0000 (16:29 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 20 Jan 2026 12:56:27 +0000 (12:56 +0000)
Do it the same way as in strrchr_m()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jan 20 12:56:27 UTC 2026 on atb-devel-224

lib/util/charset/util_str.c

index c52b77384ceedbeb953de0aa085ede3842fbca4d..4c243e6976af8a5371d62b52d5254bab0f0421cb 100644 (file)
@@ -360,7 +360,7 @@ _PUBLIC_ size_t strlen_m_term_null(const char *s)
 _PUBLIC_ char *strchr_m(const char *src, char c)
 {
        const char *s;
-       struct smb_iconv_handle *ic = get_iconv_handle();
+       struct smb_iconv_handle *ic = NULL;
        if (src == NULL) {
                return NULL;
        }
@@ -388,6 +388,8 @@ _PUBLIC_ char *strchr_m(const char *src, char c)
        s = src;
 #endif
 
+       ic = get_iconv_handle();
+
        while (*s) {
                size_t size;
                codepoint_t c2 = next_codepoint_handle(ic, s, &size);