aboutsummaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-05-27 13:46:15 +0200
committerJunio C Hamano <gitster@pobox.com>2024-05-27 11:19:59 -0700
commit6073b3b5c37716c50244d635e7c358f41f43e286 (patch)
tree6d3663eeb79e31b729d5a51ef9028ccb58848d3e /http.c
parentf962ffc392fe1831d047a10a28a55710d987d746 (diff)
downloadgit-6073b3b5c37716c50244d635e7c358f41f43e286.tar.xz
config: clarify memory ownership in `git_config_pathname()`
The out parameter of `git_config_pathname()` is a `const char **` even though we transfer ownership of memory to the caller. This is quite misleading and has led to many memory leaks all over the place. Adapt the parameter to instead be `char **`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r--http.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/http.c b/http.c
index db2e2f1d39..fa3ea87451 100644
--- a/http.c
+++ b/http.c
@@ -64,7 +64,7 @@ static char *ssl_key_type;
static char *ssl_capath;
static char *curl_no_proxy;
#ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY
-static const char *ssl_pinnedkey;
+static char *ssl_pinnedkey;
#endif
static char *ssl_cainfo;
static long curl_low_speed_limit = -1;
@@ -108,7 +108,7 @@ static struct {
static struct credential proxy_auth = CREDENTIAL_INIT;
static const char *curl_proxyuserpwd;
-static const char *curl_cookie_file;
+static char *curl_cookie_file;
static int curl_save_cookies;
struct credential http_auth = CREDENTIAL_INIT;
static int http_proactive_auth;
@@ -381,17 +381,17 @@ static int http_options(const char *var, const char *value,
if (!strcmp("http.sslversion", var))
return git_config_string(&ssl_version, var, value);
if (!strcmp("http.sslcert", var))
- return git_config_pathname((const char **)&ssl_cert, var, value);
+ return git_config_pathname(&ssl_cert, var, value);
if (!strcmp("http.sslcerttype", var))
return git_config_string((const char **)&ssl_cert_type, var, value);
if (!strcmp("http.sslkey", var))
- return git_config_pathname((const char **)&ssl_key, var, value);
+ return git_config_pathname(&ssl_key, var, value);
if (!strcmp("http.sslkeytype", var))
return git_config_string((const char **)&ssl_key_type, var, value);
if (!strcmp("http.sslcapath", var))
- return git_config_pathname((const char **)&ssl_capath, var, value);
+ return git_config_pathname(&ssl_capath, var, value);
if (!strcmp("http.sslcainfo", var))
- return git_config_pathname((const char **)&ssl_cainfo, var, value);
+ return git_config_pathname(&ssl_cainfo, var, value);
if (!strcmp("http.sslcertpasswordprotected", var)) {
ssl_cert_password_required = git_config_bool(var, value);
return 0;