* lock the list just while adding the new piece into it.
authorWilfried Göesgens <willi@citadel.org>
Wed, 28 May 2008 22:08:57 +0000 (22:08 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 28 May 2008 22:08:57 +0000 (22:08 +0000)
citadel/msgbase.c

index 7ce6bc5ab5a3d3fbcb2e89ea41f3109237eebd15..cb6dbae2538a47546abbe0d73da84937576e11c2 100644 (file)
@@ -2905,14 +2905,14 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,     /* message to save */
        }
 
        if (collected_addresses != NULL) {
-               begin_critical_section(S_ATBF);
                aptr = (struct addresses_to_be_filed *)
                        malloc(sizeof(struct addresses_to_be_filed));
-               aptr->next = atbf;
                MailboxName(actual_rm, sizeof actual_rm,
                        &CCC->user, USERCONTACTSROOM);
                aptr->roomname = strdup(actual_rm);
                aptr->collected_addresses = collected_addresses;
+               begin_critical_section(S_ATBF);
+               aptr->next = atbf;
                atbf = aptr;
                end_critical_section(S_ATBF);
        }