summary refs log tree commit diff
path: root/unmime.c
diff options
context:
space:
mode:
Diffstat (limited to 'unmime.c')
-rw-r--r--unmime.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/unmime.c b/unmime.c
index 68ee514..8c0c147 100644
--- a/unmime.c
+++ b/unmime.c
@@ -19,19 +19,20 @@ void
 recmime(struct message *msg, int depth)
 {
 	struct message *imsg = 0;
-	char *ct, *body;
+	char *ct, *body, *bodychunk;
 	size_t bodylen;
 
-	if (blaze822_mime_body(msg, &ct, &body, &bodylen)) {
+	if (blaze822_mime_body(msg, &ct, &body, &bodylen, &bodychunk)) {
 		printf("%*.sbody %s len %d\n", depth*2, "", ct, bodylen);
-		if (strncmp(ct, "multipart/", 10) == 0)
+		if (strncmp(ct, "multipart/", 10) == 0) {
 			while (blaze822_multipart(msg, &imsg))
 				recmime(imsg, depth+1);
-		else if (strncmp(ct, "text/", 5) == 0) {
+		} else if (strncmp(ct, "text/", 5) == 0) {
 			printf("---\n");
 			fwrite(body, bodylen, 1, stdout);
 			printf("---\n");
 		}
+		free(bodychunk);
 	}
 }
 
@@ -50,6 +51,8 @@ unmime(char *file)
 		return;
 
 	recmime(msg, 0);
+
+	blaze822_free(msg);
 }
 
 int