mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
ext/gd create gd object with zend_object_alloc (#17823)
while at it, fix build warning "wrong" calloc arguments order
This commit is contained in:
parent
82bdc8a2ad
commit
18df1e4783
2 changed files with 3 additions and 5 deletions
|
@ -167,9 +167,7 @@ PHP_GD_API gdImagePtr php_gd_libgdimageptr_from_zval_p(zval* zp)
|
||||||
|
|
||||||
zend_object *php_gd_image_object_create(zend_class_entry *class_type)
|
zend_object *php_gd_image_object_create(zend_class_entry *class_type)
|
||||||
{
|
{
|
||||||
size_t block_len = sizeof(php_gd_image_object) + zend_object_properties_size(class_type);
|
php_gd_image_object *intern = zend_object_alloc(sizeof(php_gd_image_object), class_type);
|
||||||
php_gd_image_object *intern = emalloc(block_len);
|
|
||||||
memset(intern, 0, block_len);
|
|
||||||
|
|
||||||
zend_object_std_init(&intern->std, class_type);
|
zend_object_std_init(&intern->std, class_type);
|
||||||
object_properties_init(&intern->std, class_type);
|
object_properties_init(&intern->std, class_type);
|
||||||
|
|
|
@ -3190,8 +3190,8 @@ int gdImagePaletteToTrueColor(gdImagePtr src)
|
||||||
// Note: do not revert back to gdMalloc() below ; reason here,
|
// Note: do not revert back to gdMalloc() below ; reason here,
|
||||||
// due to a bug with a certain memory_limit INI value treshold,
|
// due to a bug with a certain memory_limit INI value treshold,
|
||||||
// imagepalettetotruecolor crashes with even unrelated ZendMM allocations.
|
// imagepalettetotruecolor crashes with even unrelated ZendMM allocations.
|
||||||
// See GH-17772 for an use case.
|
// See GH-17772 for a use case.
|
||||||
src->tpixels = (int **) gdCalloc(sizeof(int *), sy);
|
src->tpixels = (int **) gdCalloc(sy, sizeof(int *));
|
||||||
if (src->tpixels == NULL) {
|
if (src->tpixels == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue