From 90cde4acb587de74d18f47656a9f951fbe1f7a4b Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 24 Apr 2022 22:33:51 -0700 Subject: [PATCH] ... --- src/add.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/add.c b/src/add.c index 75fe2e7..3afaacb 100644 --- a/src/add.c +++ b/src/add.c @@ -87,6 +87,12 @@ static void *add_hash(void *unused) { log_info(ADD_MESSAGE_ADDED_FILE,p->file->path); + /* + * add_queue_entry_free free's struct file + * if pointer is not NULL; since add was successful, + * that is unnecessary. + */ + p->file = NULL; add_queue_entry_free(p); } @@ -125,7 +131,7 @@ static int add_queue_entry_add_torrent(struct add_queue_entry *entry,struct torr static void add_queue_entry_free(struct add_queue_entry *p) { struct add_queue_torrent *to_free; - file_free(p->file); + if(p->file!=NULL) { file_free(p->file); } while(p->torrents!=NULL) { to_free = p->torrents; -- 2.39.5