mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-04 00:55:04 +00:00
Plug test leaks
This commit is contained in:
parent
cf7038a65c
commit
cd74cbba18
@ -1,10 +1,24 @@
|
|||||||
#include "clar_libgit2.h"
|
#include "clar_libgit2.h"
|
||||||
#include "netops.h"
|
#include "netops.h"
|
||||||
|
|
||||||
|
char *host, *port, *user, *pass;
|
||||||
|
|
||||||
|
void test_network_urlparse__initialize(void)
|
||||||
|
{
|
||||||
|
host = port = user = pass = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_network_urlparse__cleanup(void)
|
||||||
|
{
|
||||||
|
#define FREE_AND_NULL(x) if (x) { git__free(x); x = NULL; }
|
||||||
|
FREE_AND_NULL(host);
|
||||||
|
FREE_AND_NULL(port);
|
||||||
|
FREE_AND_NULL(user);
|
||||||
|
FREE_AND_NULL(pass);
|
||||||
|
}
|
||||||
|
|
||||||
void test_network_urlparse__trivial(void)
|
void test_network_urlparse__trivial(void)
|
||||||
{
|
{
|
||||||
char *host, *port, *user, *pass;
|
|
||||||
|
|
||||||
cl_git_pass(gitno_extract_url_parts(&host, &port, &user, &pass,
|
cl_git_pass(gitno_extract_url_parts(&host, &port, &user, &pass,
|
||||||
"example.com/resource", "8080"));
|
"example.com/resource", "8080"));
|
||||||
cl_assert_equal_s(host, "example.com");
|
cl_assert_equal_s(host, "example.com");
|
||||||
@ -15,8 +29,6 @@ void test_network_urlparse__trivial(void)
|
|||||||
|
|
||||||
void test_network_urlparse__user(void)
|
void test_network_urlparse__user(void)
|
||||||
{
|
{
|
||||||
char *host, *port, *user, *pass;
|
|
||||||
|
|
||||||
cl_git_pass(gitno_extract_url_parts(&host, &port, &user, &pass,
|
cl_git_pass(gitno_extract_url_parts(&host, &port, &user, &pass,
|
||||||
"user@example.com/resource", "8080"));
|
"user@example.com/resource", "8080"));
|
||||||
cl_assert_equal_s(host, "example.com");
|
cl_assert_equal_s(host, "example.com");
|
||||||
@ -27,8 +39,6 @@ void test_network_urlparse__user(void)
|
|||||||
|
|
||||||
void test_network_urlparse__user_pass(void)
|
void test_network_urlparse__user_pass(void)
|
||||||
{
|
{
|
||||||
char *host, *port, *user, *pass;
|
|
||||||
|
|
||||||
/* user:pass@hostname.tld/resource */
|
/* user:pass@hostname.tld/resource */
|
||||||
cl_git_pass(gitno_extract_url_parts(&host, &port, &user, &pass,
|
cl_git_pass(gitno_extract_url_parts(&host, &port, &user, &pass,
|
||||||
"user:pass@example.com/resource", "8080"));
|
"user:pass@example.com/resource", "8080"));
|
||||||
@ -40,8 +50,6 @@ void test_network_urlparse__user_pass(void)
|
|||||||
|
|
||||||
void test_network_urlparse__port(void)
|
void test_network_urlparse__port(void)
|
||||||
{
|
{
|
||||||
char *host, *port, *user, *pass;
|
|
||||||
|
|
||||||
/* hostname.tld:port/resource */
|
/* hostname.tld:port/resource */
|
||||||
cl_git_pass(gitno_extract_url_parts(&host, &port, &user, &pass,
|
cl_git_pass(gitno_extract_url_parts(&host, &port, &user, &pass,
|
||||||
"example.com:9191/resource", "8080"));
|
"example.com:9191/resource", "8080"));
|
||||||
@ -53,8 +61,6 @@ void test_network_urlparse__port(void)
|
|||||||
|
|
||||||
void test_network_urlparse__user_port(void)
|
void test_network_urlparse__user_port(void)
|
||||||
{
|
{
|
||||||
char *host, *port, *user, *pass;
|
|
||||||
|
|
||||||
/* user@hostname.tld:port/resource */
|
/* user@hostname.tld:port/resource */
|
||||||
cl_git_pass(gitno_extract_url_parts(&host, &port, &user, &pass,
|
cl_git_pass(gitno_extract_url_parts(&host, &port, &user, &pass,
|
||||||
"user@example.com:9191/resource", "8080"));
|
"user@example.com:9191/resource", "8080"));
|
||||||
@ -66,8 +72,6 @@ void test_network_urlparse__user_port(void)
|
|||||||
|
|
||||||
void test_network_urlparse__user_pass_port(void)
|
void test_network_urlparse__user_pass_port(void)
|
||||||
{
|
{
|
||||||
char *host, *port, *user, *pass;
|
|
||||||
|
|
||||||
/* user:pass@hostname.tld:port/resource */
|
/* user:pass@hostname.tld:port/resource */
|
||||||
cl_git_pass(gitno_extract_url_parts(&host, &port, &user, &pass,
|
cl_git_pass(gitno_extract_url_parts(&host, &port, &user, &pass,
|
||||||
"user:pass@example.com:9191/resource", "8080"));
|
"user:pass@example.com:9191/resource", "8080"));
|
||||||
|
Loading…
Reference in New Issue
Block a user