ref: ae0332732284dfd9d8503094d64669fa8939d137
parent: d181a7286ee394a8a7b6ca7148904e5827ecabcb
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Dec 1 00:48:31 EST 2023
fs: fix getmount poperror balance
--- a/fs.c
+++ b/fs.c
@@ -454,6 +454,11 @@
return fs->snapmnt;
}
lock(&fs->mountlk);
+ if(waserror()){
+ unlock(&fs->mountlk);
+ free(mnt);
+ return nil;
+ }
for(mnt = fs->mounts; mnt != nil; mnt = mnt->next)
if(strcmp(name, mnt->name) == 0){
ainc(&mnt->ref);
@@ -461,11 +466,6 @@
}
if((mnt = mallocz(sizeof(*mnt), 1)) == nil)
goto Out;
- if(waserror()){
- unlock(&fs->mountlk);
- free(mnt);
- return nil;
- }
mnt->ref = 1;
snprint(mnt->name, sizeof(mnt->name), "%s", name);
if((t = opensnap(name, &mnt->mutable)) == nil)
@@ -1014,6 +1014,7 @@
r.qid = d.qid;
respond(m, &r);
poperror();
+
Err: clunkdent(de);
clunkmount(mnt);