summaryrefslogtreecommitdiff
path: root/ext/gd/gd.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-10-01 17:10:56 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-10-01 18:37:24 +0200
commit62c6d6952ead055b2a08636eacdce6bb74168de1 (patch)
treedd10a67fd638fb0568938ba07544d500bc9d8eb1 /ext/gd/gd.c
parentd96219c185e68c82beb994db2c93bd26f47ce16a (diff)
downloadphp-git-62c6d6952ead055b2a08636eacdce6bb74168de1.tar.gz
Add test instantiating all objects
Intended to find issues in opaque object destructors. Closes GH-6251.
Diffstat (limited to 'ext/gd/gd.c')
-rw-r--r--ext/gd/gd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 6f1ab3cf42..462b125968 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -199,9 +199,9 @@ zend_object *php_gd_image_object_create(zend_class_entry *class_type)
static void php_gd_image_object_free(zend_object *intern)
{
php_gd_image_object *img_obj_ptr = php_gd_exgdimage_from_zobj_p(intern);
- gdImageDestroy(img_obj_ptr->image);
- img_obj_ptr->image = NULL;
-
+ if (img_obj_ptr->image) {
+ gdImageDestroy(img_obj_ptr->image);
+ }
zend_object_std_dtor(intern);
}