...
authoralex <[email protected]>
Mon, 25 Apr 2022 05:33:51 +0000 (22:33 -0700)
committeralex <[email protected]>
Mon, 25 Apr 2022 05:33:51 +0000 (22:33 -0700)
src/add.c

index 75fe2e72d210c5ce4d4ad24a7ea97b30acb112a3..3afaacbfa59ada4a4f69f1279805116822080836 100644 (file)
--- 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;