shithub: unionfs

Download patch

ref: 403d2f503e7d1892ce6ec5089af66ecef69f4047
parent: 345a5b55e4275c8282150f8e635804e0fbe0339a
author: kvik <[email protected]>
date: Fri Jun 4 06:58:13 EDT 2021

Close fd on error

--- a/unionfs.c
+++ b/unionfs.c
@@ -350,11 +350,14 @@
 	for(i = 0; i < nbranch; i++)
 		if(branch[i].create == 1)
 			break;
+	fd = -1;
 	realpath = s_new();
 	walk(realpath, branch[i].root, s_to_c(parent->path));
 	if(mkdirp(s_to_c(realpath)) < 0){
 error:
 		s_free(realpath);
+		if(fd != -1)
+			close(fd);
 		responderror(r);
 		srvacquire(&thefs);
 		return;