From 3746ab24c71d199b62203f290fd3d71a97b8aa0b Mon Sep 17 00:00:00 2001 From: David Crosby Date: Tue, 30 Jun 2015 23:04:46 -0600 Subject: Free tmp --- cookie.c | 1 + 1 file changed, 1 insertion(+) (limited to 'cookie.c') diff --git a/cookie.c b/cookie.c index c11649c..b7ea016 100644 --- a/cookie.c +++ b/cookie.c @@ -105,6 +105,7 @@ make_portlist(Str port) pl->next = first; first = pl; } + Strfree(tmp); return first; } -- cgit v1.2.3 From 9cbcd21d8d845f3bd3ecf1485e0e6ca5c9e891dc Mon Sep 17 00:00:00 2001 From: David Crosby Date: Tue, 30 Jun 2015 23:10:29 -0600 Subject: Change total_dot_number to unsigned int --- cookie.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cookie.c') diff --git a/cookie.c b/cookie.c index b7ea016..cd0c38c 100644 --- a/cookie.c +++ b/cookie.c @@ -22,10 +22,10 @@ static int is_saved = 1; #define contain_no_dots(p, ep) (total_dot_number((p),(ep),1)==0) -static int +static unsigned int total_dot_number(char *p, char *ep, int max_count) { - int count = 0; + unsigned int count = 0; if (!ep) ep = p + strlen(p); @@ -325,7 +325,7 @@ add_cookie(ParsedURL *pu, Str name, Str value, if (version == 0) { /* [NETSCAPE] rule */ - int n = total_dot_number(domain->ptr, + unsigned int n = total_dot_number(domain->ptr, domain->ptr + domain->length, 3); if (n < 2) { -- cgit v1.2.3 From 80b38e6bc3fe5a2441ffaa6df68f8cfc87c4e681 Mon Sep 17 00:00:00 2001 From: David Crosby Date: Thu, 9 Jul 2015 20:55:19 -0600 Subject: Fix resource leak in load_cookies --- cookie.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'cookie.c') diff --git a/cookie.c b/cookie.c index cd0c38c..20dcb2a 100644 --- a/cookie.c +++ b/cookie.c @@ -518,36 +518,36 @@ load_cookies(void) cookie->commentURL = NULL; parseURL(readcol(&str)->ptr, &cookie->url, NULL); if (!*str) - return; + break; cookie->name = readcol(&str); if (!*str) - return; + break; cookie->value = readcol(&str); if (!*str) - return; + break; cookie->expires = (time_t) atol(readcol(&str)->ptr); if (!*str) - return; + break; cookie->domain = readcol(&str); if (!*str) - return; + break; cookie->path = readcol(&str); if (!*str) - return; + break; cookie->flag = atoi(readcol(&str)->ptr); if (!*str) - return; + break; cookie->version = atoi(readcol(&str)->ptr); if (!*str) - return; + break; cookie->comment = readcol(&str); if (cookie->comment->length == 0) cookie->comment = NULL; if (!*str) - return; + break; cookie->portl = make_portlist(readcol(&str)); if (!*str) - return; + break; cookie->commentURL = readcol(&str); if (cookie->commentURL->length == 0) cookie->commentURL = NULL; -- cgit v1.2.3 From adcc02592c9641eb85d56526397f7af4166f81cc Mon Sep 17 00:00:00 2001 From: David Crosby Date: Sun, 26 Jul 2015 00:08:22 -0600 Subject: Use unsigned int for max_count --- cookie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cookie.c') diff --git a/cookie.c b/cookie.c index 20dcb2a..8a6f447 100644 --- a/cookie.c +++ b/cookie.c @@ -23,7 +23,7 @@ static int is_saved = 1; #define contain_no_dots(p, ep) (total_dot_number((p),(ep),1)==0) static unsigned int -total_dot_number(char *p, char *ep, int max_count) +total_dot_number(char *p, char *ep, unsigned int max_count) { unsigned int count = 0; if (!ep) -- cgit v1.2.3