diff options
| author | Chong Yidong | 2012-09-21 11:52:23 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-09-21 11:52:23 +0800 |
| commit | 09c01941f40d1f334435f3aee8f4a66459e47866 (patch) | |
| tree | 4c9ec676b53f0e10e856c6b857b51978c8d57f5c /src | |
| parent | ab199df27bfb6f2aab005b5700da961b3468c97f (diff) | |
| download | emacs-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')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/image.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f3b8b2108e1..31db282c6e3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-09-21 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * image.c (define_image_type): Avoid adding duplicate types to | ||
| 4 | image_types (Bug#12463). Suggested by Jörg Walter. | ||
| 5 | |||
| 1 | 2012-09-21 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 6 | 2012-09-21 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
| 2 | 7 | ||
| 3 | * unexmacosx.c: Define LC_DATA_IN_CODE if not defined. | 8 | * unexmacosx.c: Define LC_DATA_IN_CODE if not defined. |
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; |