fix double-free when there are multiple mxes
authorArt Cancro <ajc@citadel.org>
Fri, 7 Apr 2017 12:35:58 +0000 (08:35 -0400)
committerArt Cancro <ajc@citadel.org>
Fri, 7 Apr 2017 12:35:58 +0000 (08:35 -0400)
citadel/modules/smtp/serv_smtpclient.c

index a7fb3052e54f3525d0983934d84f9f939a83059b..bfe665984698ee69922f2843b03779ad30924c28 100644 (file)
@@ -261,10 +261,10 @@ int smtp_attempt_delivery(long msgid, char *recp, char *envelope_from)
                                response_code = 421;
                        }
 
-               if (recipients != NULL) {
                        curl_slist_free_all(recipients);
-               }
-               curl_easy_cleanup(curl);
+                       recipients = NULL;                                                              // this gets reused; avoid double-free
+                       curl_easy_cleanup(curl);
+                       curl = NULL;                                                                    // this gets reused; avoid double-free
                }
        }