mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 02:56:17 +00:00
smart subtransport: don't free the url when resetting the stream
We reset the stream in the RPC (HTTP) case constantly and then pass the url field to the action method for the transport to perform their action. A transport would thus get `NULL` for the url and if it does use it, it might crash or at least return an error making it impossible for it to work. The transports that come with libgit2 keep their own copy of the url and thus this issue was not noticed.
This commit is contained in:
@@ -46,9 +46,6 @@ GIT_INLINE(int) git_smart__reset_stream(transport_smart *t, bool close_subtransp
|
||||
}
|
||||
|
||||
if (close_subtransport) {
|
||||
git__free(t->url);
|
||||
t->url = NULL;
|
||||
|
||||
if (t->wrapped->close(t->wrapped) < 0)
|
||||
return -1;
|
||||
}
|
||||
@@ -223,6 +220,7 @@ static int git_smart__connect(
|
||||
if (git_smart__reset_stream(t, true) < 0)
|
||||
return -1;
|
||||
|
||||
git__free(t->url);
|
||||
t->url = git__strdup(url);
|
||||
GITERR_CHECK_ALLOC(t->url);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user