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 (2010-12-09)
parents ca2d11aec2a3
children 55c530a83d51
files src/spool.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/spool.c	Thu Dec 09 13:53:48 2010 -0300
+++ b/src/spool.c	Thu Dec 09 14:59:42 2010 -0300
@@ -182,13 +182,16 @@
 	/* mail headers */
 	while ((len = read_line(in, buf, MAX_DATALINE)) > 0) {
 		if (strncasecmp(buf, "HD:", 3) == 0) {
+			DEBUG(6) debugf("spool_read_header(): hdr start\n");
 			hdr = get_header(&(buf[3]));
 			msg->hdr_list = g_list_append(msg->hdr_list, hdr);
 		} else if ((buf[0] == ' ' || buf[0] == '\t') && hdr) {
+			DEBUG(6) debugf("spool_read_header(): hdr continuation\n");
 			char *tmp = hdr->header;
 			/* header continuation */
 			hdr->header = g_strconcat(hdr->header, buf, NULL);
 			hdr->value = hdr->header + (hdr->value - tmp);
+			free(tmp);  /* because g_strconcat() allocs and copies */
 		} else {
 			break;
 		}