Skip to content

Commit

Permalink
Fixed 2 memleaks:
Browse files Browse the repository at this point in the history
- we need to clean allocated string
- double array_init() means double malloc()
  • Loading branch information
Mikhail Galanin authored and Danack committed Jun 23, 2024
1 parent 823e7f0 commit ead35bd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions imagick_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -8855,7 +8855,7 @@ void s_add_named_strings (zval *array, const char *haystack TSRMLS_DC)
}
}
}
// zend_string_release(line_string); - 0 in zend_string_init means no need to free?
zend_string_release(line_string);
zend_string_release(trim);
line = php_strtok_r (NULL, "\r\n", &last_ptr);
#else
Expand Down Expand Up @@ -8939,9 +8939,8 @@ PHP_METHOD(Imagick, identifyImage)
#else
MAKE_STD_ZVAL(array);
pArray = array;
#endif

array_init(pArray);
#endif

add_assoc_long (pArray, "width", MagickGetImageWidth (intern->magick_wand));
add_assoc_long (pArray, "height", MagickGetImageHeight (intern->magick_wand));
Expand Down

0 comments on commit ead35bd

Please sign in to comment.