[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev [2.8.1dev.25] patch for memory leaks in LYCookie.c + leak comme
From: |
brian j. pardy |
Subject: |
lynx-dev [2.8.1dev.25] patch for memory leaks in LYCookie.c + leak comments |
Date: |
Mon, 7 Sep 1998 15:19:03 -0700 |
This patch cleans up a few leaks I left in cookie_add_acceptlist() and
cookie_add_rejectlist() in LYCookie.c. These were leaking 4 bytes for each
entry in COOKIE_ACCEPT_DOMAINS.
It doesn't do anything for a couple other leaks I see in LYCookie.c (one
in RP's persistent cookie code (line 404) which I've duplicated in
cookie_add_{accept,reject}list()).
This leak looks like:
Memory leak detected.
Pointer: 0x819b2e8
Contains: ||||||||||||
ByteSize: 12
FileName: ./LYCookie.c
LineCount: 404
This patch also includes the fix to LYLoadCookies() which was causing
duplicate invalid cookies to be loaded (which I sent to the list three
times -- this one works right. So those old ones can be disregarded. Sorry
about that...)
I think these leaks are cleaned up when the cookie jar is free'd.
Other leaks:
LYMain.c:
Two of em.
Memory leak detected.
Pointer: 0x817e5a0
Contains: LYNX_VERSION=2.8.1dev.25|
ByteSize: 25
FileName: ./LYMain.c
LineCount: 672
realloced: ./LYMain.c
LineCount: 673
Memory leak detected.
Pointer: 0x81862b8
Contains: /home/pk/.lynx_cookies|
ByteSize: 23
FileName: ./LYMain.c
LineCount: 1526
realloced: ./LYMain.c
LineCount: 1530
HTStyle.c:
Two of em.
Memory leak detected.
Pointer: 0x819e0f8
Contains: ||||h ||
ByteSize: 8
FileName: ../../../WWW/Library/Implementation/HTStyle.c
LineCount: 287
Memory leak detected.
Pointer: 0x81a2068
Contains: ||||F|||D|||||||||||||||||||||||||||||||||||||||||
ByteSize: 76
FileName: ../../../WWW/Library/Implementation/HTStyle.c
LineCount: 21
enable-find-leaks is NEAT.
diff -cr lynx2.8.1dev.25/src/LYCookie.c lynx2.8.1dev.25.bri/src/LYCookie.c
*** lynx2.8.1dev.25/src/LYCookie.c Mon Sep 7 03:02:16 1998
--- lynx2.8.1dev.25.bri/src/LYCookie.c Mon Sep 7 15:00:22 1998
***************
*** 1845,1852 ****
int tok_loop;
char *tok_values[] = {domain, what, path, secure, expires_a, name,
value, NULL};
char *tok_out, *tok_ptr;
! fgets(buf, 4999, cookie_handle); /* test return value */
/*
* Tokenise the cookie line into it's component parts -
--- 1845,1857 ----
int tok_loop;
char *tok_values[] = {domain, what, path, secure, expires_a, name,
value, NULL};
char *tok_out, *tok_ptr;
+ char *j;
! j = fgets(buf, 4999, cookie_handle);
!
! if((j == NULL) || (buf[0] == '\0' || buf[0] == '\n')) {
! continue;
! }
/*
* Tokenise the cookie line into it's component parts -
***************
*** 2438,2444 ****
domain_entry *de2 = NULL;
HTList *hl;
char **str = (char **)calloc(1, sizeof(acceptstr));
! char *strsmall = (char *)calloc(1, sizeof(acceptstr));
int isexisting = FALSE;
/* is this the first cookie we're handling? if so, initialize the
--- 2443,2450 ----
domain_entry *de2 = NULL;
HTList *hl;
char **str = (char **)calloc(1, sizeof(acceptstr));
! char *astr = NULL;
! char *strsmall = NULL;
int isexisting = FALSE;
/* is this the first cookie we're handling? if so, initialize the
***************
*** 2451,2457 ****
total_cookies = 0;
}
! *str = acceptstr;
for(; (strsmall = LYstrsep(str, ","));) {
if(strsmall == NULL)
--- 2457,2465 ----
total_cookies = 0;
}
! StrAllocCopy(astr, acceptstr);
!
! *str = astr;
for(; (strsmall = LYstrsep(str, ","));) {
if(strsmall == NULL)
***************
*** 2490,2495 ****
--- 2498,2504 ----
FREE(str);
FREE(strsmall);
+ FREE(astr);
}
***************
*** 2505,2511 ****
domain_entry *de2 = NULL;
HTList *hl;
char **str = (char **)calloc(1, sizeof(rejectstr));
! char *strsmall = (char *)calloc(1, sizeof(rejectstr));
int isexisting = FALSE;
/* is this the first cookie we're handling? if so, initialize the
--- 2514,2521 ----
domain_entry *de2 = NULL;
HTList *hl;
char **str = (char **)calloc(1, sizeof(rejectstr));
! char *rstr = NULL;
! char *strsmall = NULL;
int isexisting = FALSE;
/* is this the first cookie we're handling? if so, initialize the
***************
*** 2518,2524 ****
total_cookies = 0;
}
! *str = rejectstr;
for(; (strsmall = LYstrsep(str, ","));) {
if(strsmall == NULL)
--- 2528,2536 ----
total_cookies = 0;
}
! StrAllocCopy(rstr, rejectstr);
!
! *str = rstr;
for(; (strsmall = LYstrsep(str, ","));) {
if(strsmall == NULL)
***************
*** 2541,2547 ****
}
if(!isexisting) {
! de = (domain_entry *)calloc(1, sizeof(domain_entry));
if (de == NULL)
outofmem(__FILE__, "cookie_add_rejectlist");
--- 2553,2559 ----
}
if(!isexisting) {
! de = (domain_entry *)calloc(1, sizeof(domain_entry));
if (de == NULL)
outofmem(__FILE__, "cookie_add_rejectlist");
***************
*** 2557,2562 ****
--- 2569,2575 ----
FREE(str);
FREE(strsmall);
+ FREE(rstr);
}
#ifdef GLOBALDEF_IS_MACRO
--
"Posterkid does not own Usenet. Post all you want." -Darrell M. Crosgrove
Try to be the best of whatever you are, even if what you are is no good.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- lynx-dev [2.8.1dev.25] patch for memory leaks in LYCookie.c + leak comments,
brian j. pardy <=