ref: 87c0fa596894a5bbca89d38c1ccfadbfd7ae8f0a
parent: 227c880ac570682905b72025a01e652f4b8da717
author: Ori Bernstein <[email protected]>
date: Mon Mar 9 16:01:20 EDT 2020
fix refs on empty dir we were not increasing the reference count on the empty directory when returning it, so we would eventually release it twice. oops.
--- a/fs.c
+++ b/fs.c
@@ -237,9 +237,9 @@
aux = p;
c = crumb(aux, 0);
e = c->obj;
- m = e->tree->ent[i].mode;
if(i >= e->tree->nent)
return -1;
+ m = e->tree->ent[i].mode;
if(e->tree->ent[i].ismod)
o = emptydir();
else if((o = readobject(e->tree->ent[i].h)) == nil)
--- a/util.c
+++ b/util.c
@@ -13,7 +13,7 @@
static Object *e;
if(e != nil)
- return e;
+ return ref(e);
e = emalloc(sizeof(Object));
e->hash = Zhash;
e->type = GTree;