[evolution/webkit: 73/113] Fix memory leak and prevent some crashes
- From: Dan VrÃtil <dvratil src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/webkit: 73/113] Fix memory leak and prevent some crashes
- Date: Tue, 10 Jan 2012 09:54:44 +0000 (UTC)
commit 2e86b560c0c889d0a3eac232b996c235b5fdd0a8
Author: Dan VrÃtil <dvratil redhat com>
Date: Thu Dec 1 17:29:00 2011 +0100
Fix memory leak and prevent some crashes
- clear all headers in EMFormat->headers_list
- verify that handler->parse_func is not null before calling it
em-format/em-format.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/em-format/em-format.c b/em-format/em-format.c
index b6e9327..4172025 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -34,7 +34,7 @@
#include "shell/e-shell.h"
#include "shell/e-shell-settings.h"
-#define d(x)
+#define d(x) x
struct _EMFormatPrivate {
GNode *current_node;
@@ -1388,6 +1388,8 @@ em_format_finalize (GObject *object)
emf->priv->charset = NULL;
}
+ em_format_clear_headers (emf);
+
/* Chain up to parent's finalize() method */
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -1922,18 +1924,24 @@ em_format_parse_part_as (EMFormat *emf,
ninfo.is_attachment = TRUE;
handler = em_format_find_handler (emf, "x-evolution/message/attachment");
ninfo.handler = handler;
- handler->parse_func (emf, part, part_id, &ninfo, cancellable);
+
+ if (handler && handler->parse_func)
+ handler->parse_func (emf, part, part_id, &ninfo, cancellable);
+
return;
}
handler = em_format_find_handler (emf, mime_type);
- if (handler) {
+ if (handler && handler->parse_func) {
ninfo.handler = handler;
handler->parse_func (emf, part, part_id, &ninfo, cancellable);
} else {
handler = em_format_find_handler (emf, "x-evolution/message/attachment");
ninfo.handler = handler;
- handler->parse_func (emf, part, part_id, &ninfo, cancellable);
+
+ /* When this fails, something is probably very wrong...*/
+ if (handler && handler->parse_func)
+ handler->parse_func (emf, part, part_id, &ninfo, cancellable);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]