Commit 09c01941 authored by Chong Yidong's avatar Chong Yidong

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
parent ab199df2
2012-09-21 Chong Yidong <cyd@gnu.org>
* image.c (define_image_type): Avoid adding duplicate types to
image_types (Bug#12463). Suggested by Jörg Walter.
2012-09-21 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* unexmacosx.c: Define LC_DATA_IN_CODE if not defined.
......
......@@ -590,9 +590,15 @@ define_image_type (struct image_type *type, int loaded)
success = Qnil;
else
{
struct image_type *p;
Lisp_Object target_type = *(type->type);
for (p = image_types; p; p = p->next)
if (EQ (*(p->type), target_type))
return Qt;
/* Make a copy of TYPE to avoid a bus error in a dumped Emacs.
The initialized data segment is read-only. */
struct image_type *p = xmalloc (sizeof *p);
p = xmalloc (sizeof *p);
*p = *type;
p->next = image_types;
image_types = p;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment