aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorChong Yidong2012-09-21 11:52:23 +0800
committerChong Yidong2012-09-21 11:52:23 +0800
commit09c01941f40d1f334435f3aee8f4a66459e47866 (patch)
tree4c9ec676b53f0e10e856c6b857b51978c8d57f5c /src/image.c
parentab199df27bfb6f2aab005b5700da961b3468c97f (diff)
downloademacs-09c01941f40d1f334435f3aee8f4a66459e47866.tar.gz
emacs-09c01941f40d1f334435f3aee8f4a66459e47866.zip
Fix list duplication error in define_image_type.
* image.c (define_image_type): Avoid adding duplicate types to image_types. Suggested by Jörg Walter. Fixes: debbugs:12463
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/image.c b/src/image.c
index 8fc1c8637eb..8d690df8abb 100644
--- a/src/image.c
+++ b/src/image.c
@@ -590,9 +590,15 @@ define_image_type (struct image_type *type, int loaded)
590 success = Qnil; 590 success = Qnil;
591 else 591 else
592 { 592 {
593 struct image_type *p;
594 Lisp_Object target_type = *(type->type);
595 for (p = image_types; p; p = p->next)
596 if (EQ (*(p->type), target_type))
597 return Qt;
598
593 /* Make a copy of TYPE to avoid a bus error in a dumped Emacs. 599 /* Make a copy of TYPE to avoid a bus error in a dumped Emacs.
594 The initialized data segment is read-only. */ 600 The initialized data segment is read-only. */
595 struct image_type *p = xmalloc (sizeof *p); 601 p = xmalloc (sizeof *p);
596 *p = *type; 602 *p = *type;
597 p->next = image_types; 603 p->next = image_types;
598 image_types = p; 604 image_types = p;