message.c: Free leaked memory in notmuch_message object
authorCarl Worth <cworth@cworth.org>
Tue, 20 Oct 2009 19:48:14 +0000 (12:48 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 20 Oct 2009 19:48:14 +0000 (12:48 -0700)
We were careful to free this memory when we finished parsing the
headers, but we missed it for the case of closing the message
without ever parsing all of the headers.

message.c

index bd551ccd1a0a14eb899a0dc91ee019fbb18d26ae..e6488a3711cfdb9d976421878c2d1cc1911638c0 100644 (file)
--- a/message.c
+++ b/message.c
@@ -104,6 +104,12 @@ notmuch_message_close (notmuch_message_t *message)
     if (message == NULL)
        return;
 
     if (message == NULL)
        return;
 
+    if (message->line)
+       free (message->line);
+
+    if (message->value.size)
+       free (message->value.str);
+
     if (message->headers)
        g_hash_table_unref (message->headers);
 
     if (message->headers)
        g_hash_table_unref (message->headers);