1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-20 10:23:57 +00:00

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
This commit is contained in:
Chong Yidong 2012-09-21 11:52:23 +08:00
parent ab199df27b
commit 09c01941f4
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,8 @@
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.

View File

@ -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;