fix double-free when there are multiple mxes
[citadel.git] / citadel / modules / smtp / serv_smtpclient.c
index 62dfbb30b53c96b0f3ce1d3a712232f98085e306..bfe665984698ee69922f2843b03779ad30924c28 100644 (file)
@@ -261,8 +261,10 @@ int smtp_attempt_delivery(long msgid, char *recp, char *envelope_from)
                                response_code = 421;
                        }
 
-               curl_slist_free_all(recipients);
-               curl_easy_cleanup(curl);
+                       curl_slist_free_all(recipients);
+                       recipients = NULL;                                                              // this gets reused; avoid double-free
+                       curl_easy_cleanup(curl);
+                       curl = NULL;                                                                    // this gets reused; avoid double-free
                }
        }