]> git.notmuchmail.org Git - notmuch/commitdiff
lib/message-file: plug three memleaks.
authorAnton Khirnov <anton@khirnov.net>
Sat, 28 May 2011 21:51:51 +0000 (14:51 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 3 Jun 2011 19:30:55 +0000 (12:30 -0700)
Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
lib/message-file.c

index 7722832e9158411e8101f21cb163f0f0051b9854..99505c117b9d9d9bba1efe91dc701a11dbba3bf5 100644 (file)
@@ -341,12 +341,17 @@ notmuch_message_file_get_header (notmuch_message_file_t *message,
                strncpy(combined_header,header_sofar,hdrsofar);
                *(combined_header+hdrsofar) = ' ';
                strncpy(combined_header+hdrsofar+1,decoded_value,newhdr+1);
                strncpy(combined_header,header_sofar,hdrsofar);
                *(combined_header+hdrsofar) = ' ';
                strncpy(combined_header+hdrsofar+1,decoded_value,newhdr+1);
+               free (decoded_value);
                g_hash_table_insert (message->headers, header, combined_header);
            }
        } else {
            if (header_sofar == NULL) {
                /* Only insert if we don't have a value for this header, yet. */
                g_hash_table_insert (message->headers, header, decoded_value);
                g_hash_table_insert (message->headers, header, combined_header);
            }
        } else {
            if (header_sofar == NULL) {
                /* Only insert if we don't have a value for this header, yet. */
                g_hash_table_insert (message->headers, header, decoded_value);
+           } else {
+               free (header);
+               free (decoded_value);
+               decoded_value = header_sofar;
            }
        }
        /* if we found a match we can bail - unless of course we are
            }
        }
        /* if we found a match we can bail - unless of course we are