[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] 1.0.8 Memory leaks . . . and fixes
From: |
Steven Kneizys |
Subject: |
Re: [Nano-devel] 1.0.8 Memory leaks . . . and fixes |
Date: |
Fri, 22 Mar 2002 08:57:54 -0800 (PST) |
The problems with that seem to be the same as the problems I had
plugging the smaller leaks in the do_browser paths. Here is a shorter
patch that has just the more critical features that went into the 1.1.6
tree. It fixes a file browsing bug and plugs a few lil leaks :)
Hopefully someday soon I'll revisit the browser path leak ;-)
Thanks!
Steve...
diff -u -b -r nano-1.0.8/files.c nano-1.0.8.new/files.c
--- nano-1.0.8/files.c Wed Oct 24 07:42:21 2001
+++ nano-1.0.8.new/files.c Sun Feb 17 15:20:44 2002
@@ -1077,7 +1116,7 @@
{
int i;
- for (i = 0; i < len - 1; i++)
+ for (i = 0; i < len; i++)
free(array[i]);
free(array);
}
@@ -1116,7 +1155,10 @@
if (tmp != foo)
*tmp = 0;
else
+ { /* SPK may need to make a 'default' path here */
+ if (*tmp != '/') *(tmp) = '.';
*(tmp+1) = 0;
+ }
return;
}
@@ -1245,6 +1287,17 @@
else
path = mallocstrcpy(path, filelist[selected]);
+ /* SPK for '.' path, get the current path via getcwd */
+ if (!strcmp(path, "./..")) {
+ free(path);
+ path = getcwd(NULL, 0);
+ striponedir(path);
+ align(&path);
+ free_charptrarray(filelist, numents);
+ free(foo);
+ return do_browser(path);
+ }
+
st = filestat(path);
if (S_ISDIR(st.st_mode)) {
if (opendir(path) == NULL) {
@@ -1264,6 +1317,8 @@
}
/* Start over again with the new path value */
+ free_charptrarray(filelist, numents);
+ free(foo);
return do_browser(path);
} else {
retval = path;
--- Chris Allegretta <address@hidden> wrote:
> On Sun, Feb 17, 2002 at 01:30:30PM -0800, Steven Kneizys wrote:
> > I got a copy of 'zmalloc' on the web, and made changes, additions,
(snip!)
>
> Hi Steven,
>
> I figured I should get back to this eventually ;) I didn't apply
> the 1.0 branch patch yet because there appear to be some issues (when
> compiled with -Wall), but I think that was a simple matter of
> changing
> the 'ret' variable to a char * instead of an int. However, after
> that I
> tried linking with -lefence to make sure nothing out of the ordinary
> happened, and selecting a file from the browser bombed with a
> corrupted
> string somewhere. It seems like something's getting trampled. I'll
> try
> to have a look at it again, and if I missed a more recent version of
> the
> patch for 1.0 I apologize.
>
> Chris A
> --
> Chris Allegretta http://www.asty.org
>
> "Share and Enjoy" - Douglas Adams, 1952 - 2001
__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/
- Re: [Nano-devel] 1.0.8 Memory leaks . . . and fixes, Chris Allegretta, 2002/03/21
- Re: [Nano-devel] 1.0.8 Memory leaks . . . and fixes,
Steven Kneizys <=
- Re: [Nano-devel] 1.0.8 Memory leaks . . . and fixes, Chris Allegretta, 2002/03/23
- Re: [Nano-devel] 1.0.8 Memory leaks . . . and fixes, Rocco Corsi, 2002/03/24
- Re: [Nano-devel] 1.0.8 Memory leaks . . . and fixes, Rocco Corsi, 2002/03/24
- Re: [Nano-devel] 1.0.8 Memory leaks . . . and fixes, Chris Allegretta, 2002/03/24
- Re: [Nano-devel] 1.0.8 Memory leaks . . . and fixes, Rocco Corsi, 2002/03/24
- Re: [Nano-devel] 1.0.8 Memory leaks . . . and fixes, Chris Allegretta, 2002/03/24
- Re: [Nano-devel] 1.0.8 Memory leaks . . . and fixes, Dwayne Rightler, 2002/03/24
- Re: [Nano-devel] 1.0.8 Memory leaks . . . and fixes, Rocco Corsi, 2002/03/25
- Re: [Nano-devel] 1.0.8 Memory leaks . . . and fixes, Chris Allegretta, 2002/03/25
- Re: [Nano-devel] 1.0.8 Memory leaks . . . and fixes, Rocco Corsi, 2002/03/25