mlmmj

changeset 2add5c5f88f8

Fix some memory leaks
author Ben Schmidt
date Fri, 12 Nov 2010 00:53:36 +1100
parents 179d5a0ed686
children 62f9b36df5a5
files ChangeLog src/mlmmj-send.c
diffstat 2 files changed, 17 insertions(+), 9 deletions(-) [+]
line diff
     1.1 --- a/ChangeLog	Fri Nov 12 00:01:07 2010 +1100
     1.2 +++ b/ChangeLog	Fri Nov 12 00:53:36 2010 +1100
     1.3 @@ -1,3 +1,4 @@
     1.4 + o Fixed small memory leaks when SMTP errors occur
     1.5   o Improved error logging when requeuing
     1.6   o Fix php-admin to work when topdir contains a symlink (e.g. on Mac)
     1.7   o Better techniques for locating support files in php-admin -- existing
     2.1 --- a/src/mlmmj-send.c	Fri Nov 12 00:01:07 2010 +1100
     2.2 +++ b/src/mlmmj-send.c	Fri Nov 12 00:53:36 2010 +1100
     2.3 @@ -248,7 +248,7 @@
     2.4  	      size_t bodylen)
     2.5  {
     2.6  	int retval = 0;
     2.7 -	char *reply, *tohdr;
     2.8 +	char *reply, *reply2, *tohdr;
     2.9  
    2.10  	if(strchr(to, '@') == NULL) {
    2.11  		errno = 0;
    2.12 @@ -268,7 +268,8 @@
    2.13  				reply);
    2.14  		myfree(reply);
    2.15  		write_rset(sockfd);
    2.16 -		checkwait_smtpreply(sockfd, MLMMJ_RSET);
    2.17 +		reply2 = checkwait_smtpreply(sockfd, MLMMJ_RSET);
    2.18 +		if (reply2 != NULL) myfree(reply2);
    2.19  		return MLMMJ_FROM;
    2.20  	}
    2.21  	retval = write_rcpt_to(sockfd, to);
    2.22 @@ -280,7 +281,8 @@
    2.23  	reply = checkwait_smtpreply(sockfd, MLMMJ_RCPTTO);
    2.24  	if(reply) {
    2.25  		write_rset(sockfd);
    2.26 -		checkwait_smtpreply(sockfd, MLMMJ_RSET);
    2.27 +		reply2 = checkwait_smtpreply(sockfd, MLMMJ_RSET);
    2.28 +		if (reply2 != NULL) myfree(reply2);
    2.29  		if(mlmmjbounce && ((reply[0] == '4') || (reply[0] == '5'))
    2.30  				&& (reply[1] == '5')) {
    2.31  			myfree(reply);
    2.32 @@ -304,7 +306,8 @@
    2.33  		log_error(LOG_ARGS, "Error with DATA. Reply = [%s]", reply);
    2.34  		myfree(reply);
    2.35  		write_rset(sockfd);
    2.36 -		checkwait_smtpreply(sockfd, MLMMJ_RSET);
    2.37 +		reply2 = checkwait_smtpreply(sockfd, MLMMJ_RSET);
    2.38 +		if (reply2 != NULL) myfree(reply2);
    2.39  		return MLMMJ_DATA;
    2.40  	}
    2.41  
    2.42 @@ -362,7 +365,8 @@
    2.43  				"avail. Reply = [%s]", reply);
    2.44  		myfree(reply);
    2.45  		write_rset(sockfd);
    2.46 -		checkwait_smtpreply(sockfd, MLMMJ_RSET);
    2.47 +		reply2 = checkwait_smtpreply(sockfd, MLMMJ_RSET);
    2.48 +		if (reply2 != NULL) myfree(reply2);
    2.49  		return MLMMJ_DOT;
    2.50  	}
    2.51  
    2.52 @@ -428,7 +432,7 @@
    2.53  		   size_t bodylen, const char *verpextra)
    2.54  {
    2.55  	int retval, i;
    2.56 -	char *reply;
    2.57 +	char *reply, *reply2;
    2.58  
    2.59  	retval = write_mail_from(sockfd, from, verpextra);
    2.60  	if(retval) {
    2.61 @@ -441,7 +445,8 @@
    2.62  				reply);
    2.63  		myfree(reply);
    2.64  		write_rset(sockfd);
    2.65 -		checkwait_smtpreply(sockfd, MLMMJ_RSET);
    2.66 +		reply2 = checkwait_smtpreply(sockfd, MLMMJ_RSET);
    2.67 +		if (reply2 != NULL) myfree(reply2);
    2.68  		return MLMMJ_FROM;
    2.69  	}
    2.70  	for(i = 0; i < addrs->count; i++) {
    2.71 @@ -482,7 +487,8 @@
    2.72  		log_error(LOG_ARGS, "Error with DATA. Reply = [%s]", reply);
    2.73  		myfree(reply);
    2.74  		write_rset(sockfd);
    2.75 -		checkwait_smtpreply(sockfd, MLMMJ_RSET);
    2.76 +		reply2 = checkwait_smtpreply(sockfd, MLMMJ_RSET);
    2.77 +		if (reply2 != NULL) myfree(reply2);
    2.78  		return MLMMJ_DATA;
    2.79  	}
    2.80  
    2.81 @@ -519,7 +525,8 @@
    2.82  				"avail. Reply = [%s]", reply);
    2.83  		myfree(reply);
    2.84  		write_rset(sockfd);
    2.85 -		checkwait_smtpreply(sockfd, MLMMJ_RSET);
    2.86 +		reply2 = checkwait_smtpreply(sockfd, MLMMJ_RSET);
    2.87 +		if (reply2 != NULL) myfree(reply2);
    2.88  		return MLMMJ_DOT;
    2.89  	}
    2.90