aboutsummaryrefslogtreecommitdiff
path: root/booki.c
diff options
context:
space:
mode:
Diffstat (limited to 'booki.c')
-rw-r--r--booki.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/booki.c b/booki.c
index eb01ca1..843ed9b 100644
--- a/booki.c
+++ b/booki.c
@@ -514,6 +514,17 @@ void open(char* filepath) {
}
}
+void free_book(struct Book book) {
+ // any string can be a list of strings
+ struct es* str = book.author.next;
+ struct es* tmp;
+ while (str != NULL) {
+ tmp = str->next;
+ free(str);
+ str = tmp;
+ }
+}
+
void search(int argc, char* argv[], char* booki_file) {
struct search_opt search_opts = parse_search_options(argc, argv);
@@ -583,6 +594,7 @@ void search(int argc, char* argv[], char* booki_file) {
} else if (search_opts.edit) {
write_book(book, fixed_file);
}
+ free_book(book);
}
free(data);