File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -562,18 +562,23 @@ static int winhttp_stream_connect(winhttp_stream *s)
562562
563563 for (i = 0 ; i < t -> owner -> connect_opts .custom_headers .count ; i ++ ) {
564564 if (t -> owner -> connect_opts .custom_headers .strings [i ]) {
565+ wchar_t * custom_header_wide = NULL ;
566+
565567 git_str_clear (& buf );
566568 git_str_puts (& buf , t -> owner -> connect_opts .custom_headers .strings [i ]);
567- if (git__utf8_to_16 (ct , MAX_CONTENT_TYPE_LEN , git_str_cstr (& buf )) < 0 ) {
568- git_error_set (GIT_ERROR_OS , "failed to convert custom header to wide characters" );
569+
570+ /* Convert header to wide characters */
571+ if ((error = git__utf8_to_16_alloc (& custom_header_wide , git_str_cstr (& buf ))) < 0 )
569572 goto on_error ;
570- }
571573
572- if (!WinHttpAddRequestHeaders (s -> request , ct , (ULONG )- 1L ,
574+ if (!WinHttpAddRequestHeaders (s -> request , custom_header_wide , (ULONG )- 1L ,
573575 WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE )) {
574576 git_error_set (GIT_ERROR_OS , "failed to add a header to the request" );
577+ git__free (custom_header_wide );
575578 goto on_error ;
576579 }
580+
581+ git__free (custom_header_wide );
577582 }
578583 }
579584
You can’t perform that action at this time.
0 commit comments