mirror of
https://github.com/curl/curl.git
synced 2026-04-27 19:32:17 +03:00
tool_cfgable: free ssl-sessions at exit
Also free the memory correctly in tool_ssls_load Closes #19602
This commit is contained in:
parent
8bb8984e9d
commit
c255d2fdcb
3 changed files with 8 additions and 6 deletions
|
|
@ -260,6 +260,7 @@ static void free_globalconfig(void)
|
|||
curlx_fclose(global->trace_stream);
|
||||
global->trace_stream = NULL;
|
||||
|
||||
tool_safefree(global->ssl_sessions);
|
||||
tool_safefree(global->libcurl);
|
||||
#ifdef _WIN32
|
||||
free(global->term.buf);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "tool_sdecls.h"
|
||||
#include "tool_urlglob.h"
|
||||
#include "var.h"
|
||||
#include "memdebug.h" /* keep this as LAST include */
|
||||
|
||||
/* the type we use for storing a single boolean bit */
|
||||
#ifndef BIT
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ CURLcode tool_ssls_load(struct OperationConfig *config,
|
|||
i = imported = 0;
|
||||
while(my_get_line(fp, &buf, &error)) {
|
||||
++i;
|
||||
curl_free(shmac);
|
||||
curl_free(sdata);
|
||||
tool_safefree(shmac);
|
||||
tool_safefree(sdata);
|
||||
line = curlx_dyn_ptr(&buf);
|
||||
|
||||
c = memchr(line, ':', strlen(line));
|
||||
|
|
@ -125,8 +125,8 @@ out:
|
|||
if(fp)
|
||||
curlx_fclose(fp);
|
||||
curlx_dyn_free(&buf);
|
||||
curl_free(shmac);
|
||||
curl_free(sdata);
|
||||
free(shmac);
|
||||
free(sdata);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ static CURLcode tool_ssls_exp(CURL *easy, void *userptr,
|
|||
goto out;
|
||||
if(EOF == fputc(':', ctx->fp))
|
||||
goto out;
|
||||
curl_free(enc);
|
||||
tool_safefree(enc);
|
||||
r = curlx_base64_encode((const char *)sdata, sdata_len, &enc, &enc_len);
|
||||
if(r)
|
||||
goto out;
|
||||
|
|
@ -179,7 +179,7 @@ static CURLcode tool_ssls_exp(CURL *easy, void *userptr,
|
|||
out:
|
||||
if(r)
|
||||
warnf("Warning: error saving SSL session for '%s': %d", session_key, r);
|
||||
curl_free(enc);
|
||||
free(enc);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue