comparison src/spool.c @ 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 5a0e8ed56c2a
children b45dc53f2829
comparison
equal deleted inserted replaced
299:ca2d11aec2a3 300:d04894d0fc64
180 } 180 }
181 181
182 /* mail headers */ 182 /* mail headers */
183 while ((len = read_line(in, buf, MAX_DATALINE)) > 0) { 183 while ((len = read_line(in, buf, MAX_DATALINE)) > 0) {
184 if (strncasecmp(buf, "HD:", 3) == 0) { 184 if (strncasecmp(buf, "HD:", 3) == 0) {
185 DEBUG(6) debugf("spool_read_header(): hdr start\n");
185 hdr = get_header(&(buf[3])); 186 hdr = get_header(&(buf[3]));
186 msg->hdr_list = g_list_append(msg->hdr_list, hdr); 187 msg->hdr_list = g_list_append(msg->hdr_list, hdr);
187 } else if ((buf[0] == ' ' || buf[0] == '\t') && hdr) { 188 } else if ((buf[0] == ' ' || buf[0] == '\t') && hdr) {
189 DEBUG(6) debugf("spool_read_header(): hdr continuation\n");
188 char *tmp = hdr->header; 190 char *tmp = hdr->header;
189 /* header continuation */ 191 /* header continuation */
190 hdr->header = g_strconcat(hdr->header, buf, NULL); 192 hdr->header = g_strconcat(hdr->header, buf, NULL);
191 hdr->value = hdr->header + (hdr->value - tmp); 193 hdr->value = hdr->header + (hdr->value - tmp);
194 free(tmp); /* because g_strconcat() allocs and copies */
192 } else { 195 } else {
193 break; 196 break;
194 } 197 }
195 } 198 }
196 fclose(in); 199 fclose(in);