diff options
-rw-r--r-- | src/tool_doswin.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/tool_doswin.c b/src/tool_doswin.c index 48af3bfb8..91299986a 100644 --- a/src/tool_doswin.c +++ b/src/tool_doswin.c @@ -646,24 +646,18 @@ CURLcode FindWin32CACert(struct OperationConfig *config, if(curlinfo->features & CURL_VERSION_SSL) { DWORD res_len; - DWORD buf_tchar_size = PATH_MAX + 1; - DWORD buf_bytes_size = sizeof(TCHAR) * buf_tchar_size; + char buf[PATH_MAX]; char *ptr = NULL; - char *buf = malloc(buf_bytes_size); - if(!buf) - return CURLE_OUT_OF_MEMORY; buf[0] = '\0'; - res_len = SearchPathA(NULL, bundle_file, NULL, buf_tchar_size, buf, &ptr); + res_len = SearchPathA(NULL, bundle_file, NULL, PATH_MAX, buf, &ptr); if(res_len > 0) { Curl_safefree(config->cacert); config->cacert = strdup(buf); if(!config->cacert) result = CURLE_OUT_OF_MEMORY; } - - Curl_safefree(buf); } return result; |