Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
faf823dc
Commit
faf823dc
authored
Mar 11, 2016
by
Patrick Steinhardt
Committed by
Edward Thomson
Apr 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: transport: fix memory leaks with registering transports
parent
0370dae1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
18 deletions
+17
-18
tests/transport/register.c
+17
-18
No files found.
tests/transport/register.c
View file @
faf823dc
...
...
@@ -40,20 +40,23 @@ void test_transport_register__custom_transport_error_remove_non_existing(void)
void
test_transport_register__custom_transport_ssh
(
void
)
{
const
char
*
urls
[]
=
{
"ssh://somehost:somepath"
,
"ssh+git://somehost:somepath"
,
"git+ssh://somehost:somepath"
,
"git@somehost:somepath"
,
};
git_transport
*
transport
;
unsigned
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
urls
);
i
++
)
{
#ifndef GIT_SSH
cl_git_fail_with
(
git_transport_new
(
&
transport
,
NULL
,
"ssh://somehost:somepath"
),
-
1
);
cl_git_fail_with
(
git_transport_new
(
&
transport
,
NULL
,
"ssh+git://somehost:somepath"
),
-
1
);
cl_git_fail_with
(
git_transport_new
(
&
transport
,
NULL
,
"git+ssh://somehost:somepath"
),
-
1
);
cl_git_fail_with
(
git_transport_new
(
&
transport
,
NULL
,
"git@somehost:somepath"
),
-
1
);
cl_git_fail_with
(
git_transport_new
(
&
transport
,
NULL
,
urls
[
i
]),
-
1
);
#else
cl_git_pass
(
git_transport_new
(
&
transport
,
NULL
,
"ssh://somehost:somepath"
));
cl_git_pass
(
git_transport_new
(
&
transport
,
NULL
,
"ssh+git://somehost:somepath"
));
cl_git_pass
(
git_transport_new
(
&
transport
,
NULL
,
"git+ssh://somehost:somepath"
));
cl_git_pass
(
git_transport_new
(
&
transport
,
NULL
,
"git@somehost:somepath"
));
transport
->
free
(
transport
);
cl_git_pass
(
git_transport_new
(
&
transport
,
NULL
,
urls
[
i
]));
transport
->
free
(
transport
);
#endif
}
cl_git_pass
(
git_transport_register
(
"ssh"
,
dummy_transport
,
NULL
));
...
...
@@ -63,16 +66,12 @@ void test_transport_register__custom_transport_ssh(void)
cl_git_pass
(
git_transport_unregister
(
"ssh"
));
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
urls
);
i
++
)
{
#ifndef GIT_SSH
cl_git_fail_with
(
git_transport_new
(
&
transport
,
NULL
,
"ssh://somehost:somepath"
),
-
1
);
cl_git_fail_with
(
git_transport_new
(
&
transport
,
NULL
,
"ssh+git://somehost:somepath"
),
-
1
);
cl_git_fail_with
(
git_transport_new
(
&
transport
,
NULL
,
"git+ssh://somehost:somepath"
),
-
1
);
cl_git_fail_with
(
git_transport_new
(
&
transport
,
NULL
,
"git@somehost:somepath"
),
-
1
);
cl_git_fail_with
(
git_transport_new
(
&
transport
,
NULL
,
urls
[
i
]),
-
1
);
#else
cl_git_pass
(
git_transport_new
(
&
transport
,
NULL
,
"ssh://somehost:somepath"
));
cl_git_pass
(
git_transport_new
(
&
transport
,
NULL
,
"ssh+git://somehost:somepath"
));
cl_git_pass
(
git_transport_new
(
&
transport
,
NULL
,
"git+ssh://somehost:somepath"
));
cl_git_pass
(
git_transport_new
(
&
transport
,
NULL
,
"git@somehost:somepath"
));
transport
->
free
(
transport
);
cl_git_pass
(
git_transport_new
(
&
transport
,
NULL
,
urls
[
i
]));
transport
->
free
(
transport
);
#endif
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment