[evolution/gnome-3-38] Fix a memory leak when quoting headers for message replies
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-38] Fix a memory leak when quoting headers for message replies
- Date: Thu, 14 Jan 2021 15:52:11 +0000 (UTC)
commit c042a301fc390a2389572f49116b35ae713d4405
Author: Milan Crha <mcrha redhat com>
Date: Thu Jan 14 16:45:52 2021 +0100
Fix a memory leak when quoting headers for message replies
This could happen when the message did not contain expected header,
the function returned early, without unreferencing the message.
src/em-format/e-mail-formatter-quote-headers.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/em-format/e-mail-formatter-quote-headers.c b/src/em-format/e-mail-formatter-quote-headers.c
index e0f349457e..7e99d012c7 100644
--- a/src/em-format/e-mail-formatter-quote-headers.c
+++ b/src/em-format/e-mail-formatter-quote-headers.c
@@ -147,8 +147,10 @@ emfqe_format_header (EMailFormatter *formatter,
medium = CAMEL_MEDIUM (mime_part);
txt = camel_medium_get_header (medium, canon_name);
- if (txt == NULL)
+ if (txt == NULL) {
+ g_object_unref (mime_part);
return;
+ }
fmt_charset = e_mail_formatter_dup_charset (formatter);
if (!fmt_charset)
@@ -160,6 +162,7 @@ emfqe_format_header (EMailFormatter *formatter,
if (addrs == NULL) {
g_free (buf);
+ g_object_unref (mime_part);
return;
}
@@ -192,8 +195,10 @@ emfqe_format_header (EMailFormatter *formatter,
txt = camel_medium_get_header (medium, "x-newsreader");
if (txt == NULL)
txt = camel_medium_get_header (medium, "x-mimeole");
- if (txt == NULL)
+ if (txt == NULL) {
+ g_object_unref (mime_part);
return;
+ }
txt = value = camel_header_format_ctext (txt, charset);
@@ -207,8 +212,10 @@ emfqe_format_header (EMailFormatter *formatter,
medium = CAMEL_MEDIUM (mime_part);
txt = camel_medium_get_header (medium, canon_name);
- if (txt == NULL)
+ if (txt == NULL) {
+ g_object_unref (mime_part);
return;
+ }
flags |= E_MAIL_FORMATTER_HEADER_FLAG_BOLD;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]