agendafs

A filesystem for your calendar.

git clone git://mccd.space/agendafs
commit 91d07b1b4475e8bdbfc16a9155fc65a769354ceb
parent 2e657d5a5b05f6b7dbc98f53372e2af5f059cced
Author: Marc Coquand <marc@coquand.email>
Date:   Tue, 22 Jul 2025 14:16:12 +0200

Add missing frees

Diffstat:
Mmain.c | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/main.c b/main.c
@@ -197,6 +197,8 @@ journal_mkdir(const char *path, mode_t mode)
 	LOG("MKDIR %s", path);
 	if (create_directory_from_fuse_path(mreg, path) != 0) {
 		pthread_mutex_unlock(&entries_mutex);
+
+		rfree_all(mreg);
 		return -EIO;
 	};
 	pthread_mutex_unlock(&entries_mutex);
@@ -371,6 +373,7 @@ journal_removexattr(const char *path, const char *header)
 		int status = set_node_categories(mreg, node, "", 0);
 		pthread_mutex_unlock(&entries_mutex);
 
+		rfree_all(mreg);
 		return status;
 	}
 	else if (strcmp(header, "user.class") == 0) {
@@ -385,6 +388,7 @@ journal_removexattr(const char *path, const char *header)
 		int status = delete_node_class(mreg, node);
 		pthread_mutex_unlock(&entries_mutex);
 
+		rfree_all(mreg);
 		return status;
 	}
 	rfree_all(mreg);
@@ -533,6 +537,7 @@ journal_getxattr(const char *path, const char *header, char *buf, size_t s)
 		if (s > 0) {
 			snprintf(buf, s, "%s", cats);
 		}
+		rfree_all(mreg);
 
 		return string_len;
 	}
@@ -542,12 +547,15 @@ journal_getxattr(const char *path, const char *header, char *buf, size_t s)
 		if (!node) {
 			pthread_mutex_unlock(&entries_mutex);
 
+			rfree_all(mreg);
 			return -ENONET;
 		}
 
 		const char *c = get_node_class(mreg, node);
 		pthread_mutex_unlock(&entries_mutex);
 		if (!c || *c == '\0') {
+
+			rfree_all(mreg);
 			return -ENODATA;
 		}
 
@@ -557,8 +565,11 @@ journal_getxattr(const char *path, const char *header, char *buf, size_t s)
 			snprintf(buf, s, "%s", c);
 		}
 
+		rfree_all(mreg);
 		return string_len;
 	}
+
+	rfree_all(mreg);
 	return -ENODATA;
 }