correct ref counting in walkfile (Nemo)
This commit is contained in:
parent
3fbe92ef1a
commit
729e53b9e5
1 changed files with 1 additions and 5 deletions
|
|
@ -232,21 +232,17 @@ File*
|
||||||
walkfile(File *f, char *path)
|
walkfile(File *f, char *path)
|
||||||
{
|
{
|
||||||
char *os, *s, *nexts;
|
char *os, *s, *nexts;
|
||||||
File *nf;
|
|
||||||
|
|
||||||
if(strchr(path, '/') == nil)
|
if(strchr(path, '/') == nil)
|
||||||
return walkfile1(f, path); /* avoid malloc */
|
return walkfile1(f, path); /* avoid malloc */
|
||||||
|
|
||||||
os = s = estrdup9p(path);
|
os = s = estrdup9p(path);
|
||||||
incref(&f->ref);
|
|
||||||
for(; *s; s=nexts){
|
for(; *s; s=nexts){
|
||||||
if(nexts = strchr(s, '/'))
|
if(nexts = strchr(s, '/'))
|
||||||
*nexts++ = '\0';
|
*nexts++ = '\0';
|
||||||
else
|
else
|
||||||
nexts = s+strlen(s);
|
nexts = s+strlen(s);
|
||||||
nf = walkfile1(f, s);
|
f = walkfile1(f, s);
|
||||||
decref(&f->ref);
|
|
||||||
f = nf;
|
|
||||||
if(f == nil)
|
if(f == nil)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue