lib/message-file: plug three memleaks.

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
This commit is contained in:
Anton Khirnov 2011-05-28 14:51:51 -07:00 committed by Carl Worth
parent a0f09b4942
commit d3fdb76c8d

View file

@ -341,12 +341,17 @@ notmuch_message_file_get_header (notmuch_message_file_t *message,
strncpy(combined_header,header_sofar,hdrsofar); strncpy(combined_header,header_sofar,hdrsofar);
*(combined_header+hdrsofar) = ' '; *(combined_header+hdrsofar) = ' ';
strncpy(combined_header+hdrsofar+1,decoded_value,newhdr+1); strncpy(combined_header+hdrsofar+1,decoded_value,newhdr+1);
free (decoded_value);
g_hash_table_insert (message->headers, header, combined_header); g_hash_table_insert (message->headers, header, combined_header);
} }
} else { } else {
if (header_sofar == NULL) { if (header_sofar == NULL) {
/* Only insert if we don't have a value for this header, yet. */ /* 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, 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