masqmail

changeset 300:d04894d0fc64

free memory in spool read for continuation header lines see the docs to g_strconcat() about memory allocation
author markus schnalke <meillo@marmaro.de>
date Thu, 09 Dec 2010 14:59:42 -0300
parents ca2d11aec2a3
children 55c530a83d51
files src/spool.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/src/spool.c	Thu Dec 09 13:53:48 2010 -0300
     1.2 +++ b/src/spool.c	Thu Dec 09 14:59:42 2010 -0300
     1.3 @@ -182,13 +182,16 @@
     1.4  	/* mail headers */
     1.5  	while ((len = read_line(in, buf, MAX_DATALINE)) > 0) {
     1.6  		if (strncasecmp(buf, "HD:", 3) == 0) {
     1.7 +			DEBUG(6) debugf("spool_read_header(): hdr start\n");
     1.8  			hdr = get_header(&(buf[3]));
     1.9  			msg->hdr_list = g_list_append(msg->hdr_list, hdr);
    1.10  		} else if ((buf[0] == ' ' || buf[0] == '\t') && hdr) {
    1.11 +			DEBUG(6) debugf("spool_read_header(): hdr continuation\n");
    1.12  			char *tmp = hdr->header;
    1.13  			/* header continuation */
    1.14  			hdr->header = g_strconcat(hdr->header, buf, NULL);
    1.15  			hdr->value = hdr->header + (hdr->value - tmp);
    1.16 +			free(tmp);  /* because g_strconcat() allocs and copies */
    1.17  		} else {
    1.18  			break;
    1.19  		}