]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
smtp: fixed a segfault during test 1320 torture test
authorDan Fandrich <dan@coneharvesters.com>
Wed, 30 Jul 2014 21:18:47 +0000 (23:18 +0200)
committerDan Fandrich <dan@coneharvesters.com>
Wed, 30 Jul 2014 21:37:24 +0000 (23:37 +0200)
Under these circumstances, the connection hasn't been fully established
and smtp_connect hasn't been called, yet smtp_done still calls the state
machine which dereferences the NULL conn pointer in struct pingpong.

lib/smtp.c

index 5938c3ff430b40d9c49ef9a74887c2d465ba0f90..da760172408128eb6b44c5d425988dc49f557dfb 100644 (file)
@@ -1642,7 +1642,7 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status,
 
   (void)premature;
 
-  if(!smtp)
+  if(!smtp || !pp->conn)
     /* When the easy handle is removed from the multi interface while libcurl
        is still trying to resolve the host name, the SMTP struct is not yet
        initialized. However, the removal action calls Curl_done() which in