[evolution/webkit: 111/134] Fix crash when removing headers from emf->header_list
- From: Dan VrÃtil <dvratil src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/webkit: 111/134] Fix crash when removing headers from emf->header_list
- Date: Wed, 14 Dec 2011 15:40:58 +0000 (UTC)
commit dabc9622dd5248fea07e698113ff366dd219160c
Author: Dan VrÃtil <dvratil redhat com>
Date: Thu Nov 24 10:43:05 2011 +0100
Fix crash when removing headers from emf->header_list
em-format/em-format.c | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/em-format/em-format.c b/em-format/em-format.c
index 0d61b51..0ef6355 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -1708,18 +1708,29 @@ em_format_remove_header (EMFormat* emf,
g_return_val_if_fail (EM_IS_FORMAT (emf), NULL);
g_return_val_if_fail (name && *name, NULL);
- for (iter = g_queue_peek_head_link (&emf->header_list); iter->next != NULL; iter = iter->next) {
-
+ iter = g_queue_peek_head_link (&emf->header_list);
+ while (iter) {
EMFormatHeader *header = iter->data;
+ if (!header->value || !*header->value) {
+ GList *next = iter->next;
+ if (g_strcmp0 (name, header->name) == 0)
+ g_queue_delete_link (&emf->header_list, iter);
+
+ iter = next;
+ continue;
+ }
+
if (value && *value) {
- if ((strcmp (name, header->name) == 0) &&
- (strcmp (value, header->value) == 0))
+ if ((g_strcmp0 (name, header->name) == 0) &&
+ (g_strcmp0 (value, header->value) == 0))
break;
} else {
- if (strcmp (name, header->name) == 0)
+ if (g_strcmp0 (name, header->name) == 0)
break;
}
+
+ iter = iter->next;
}
if (iter) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]