[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-30 b5543c54bf0: Fix NULL pointer dereferences in xpm_load_image
From: |
Po Lu |
Subject: |
emacs-30 b5543c54bf0: Fix NULL pointer dereferences in xpm_load_image |
Date: |
Tue, 23 Jul 2024 23:57:53 -0400 (EDT) |
branch: emacs-30
commit b5543c54bf08c4fa4cae6b7f404a37a2aee60cdf
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Fix NULL pointer dereferences in xpm_load_image
* src/image.c (x_destroy_x_image): Correct test condition.
(xpm_load_image): Do not release image data if it is still to be
created.
---
src/image.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/image.c b/src/image.c
index 5aabb517f30..f869a95c15d 100644
--- a/src/image.c
+++ b/src/image.c
@@ -3886,7 +3886,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width,
int height, int depth,
static void
x_destroy_x_image (XImage *ximg)
{
- if (ximg)
+ if (ximg->data)
{
xfree (ximg->data);
ximg->data = NULL;
@@ -6505,9 +6505,12 @@ xpm_load_image (struct frame *f,
failure:
image_error ("Invalid XPM3 file (%s)", img->spec);
- image_destroy_x_image (ximg);
- image_destroy_x_image (mask_img);
- image_clear_image (f, img);
+ if (ximg)
+ {
+ image_destroy_x_image (ximg);
+ image_destroy_x_image (mask_img);
+ image_clear_image (f, img);
+ }
return 0;
#undef match
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-30 b5543c54bf0: Fix NULL pointer dereferences in xpm_load_image,
Po Lu <=