diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2010-05-18 14:44:19 -0700 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2010-05-18 14:44:19 -0700 |
commit | 1d26151d5f895406c78d5d20fbad89604f9d9938 (patch) | |
tree | 21fc03a86f1e8c59f9e95e2ab1f0879b92ffc42e /lib | |
parent | aabd27d9aaefdb1c6f815567c2ff05a4449a36c3 (diff) |
Fixed a memory leak in the SMTP torture tests
Diffstat (limited to 'lib')
-rw-r--r-- | lib/smtp.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/smtp.c b/lib/smtp.c index a719ee1c8..534ab49ab 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -273,6 +273,7 @@ static int smtp_endofresp(struct pingpong *pp, int *resp) static void state(struct connectdata *conn, smtpstate newstate) { + struct smtp_conn *smtpc = &conn->proto.smtpc; #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) /* for debug purposes */ static const char * const names[]={ @@ -293,9 +294,6 @@ static void state(struct connectdata *conn, "QUIT", /* LAST */ }; -#endif - struct smtp_conn *smtpc = &conn->proto.smtpc; -#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) if(smtpc->state != newstate) infof(conn->data, "SMTP %p state change from %s to %s\n", smtpc, names[smtpc->state], names[newstate]); @@ -421,8 +419,7 @@ static CURLcode smtp_authenticate(struct connectdata *conn) state(conn, state2); } else { - if(initresp) - free(initresp); + Curl_safefree(initresp); result = Curl_pp_sendf(&smtpc->pp, "AUTH %s", mech); @@ -1322,6 +1319,10 @@ static CURLcode smtp_disconnect(struct connectdata *conn) Curl_pp_disconnect(&smtpc->pp); + /* This won't already be freed in some error cases */ + Curl_safefree(smtpc->domain); + smtpc->domain = NULL; + return CURLE_OK; } @@ -1338,6 +1339,7 @@ static CURLcode smtp_dophase_done(struct connectdata *conn, Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); free(smtpc->domain); + smtpc->domain = NULL; return CURLE_OK; } |