Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leaks in Phalcon\Image\* #1249

Merged
merged 4 commits into from Sep 18, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use phalcon_class_exists() instead of usersoace class_exists()
  • Loading branch information
sjinks committed Sep 18, 2013
commit e5e2041a0fba50f97928bfd2bc9ce6c6187ab396
14 changes: 5 additions & 9 deletions ext/image/adapter/imagick.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,21 @@ PHALCON_INIT_CLASS(Phalcon_Image_Adapter_Imagick){
*/
PHP_METHOD(Phalcon_Image_Adapter_Imagick, check){

zval *class_name, *ret = NULL;
zval class_name, *ret = NULL;

PHALCON_MM_GROW();

PHALCON_INIT_VAR(class_name);
ZVAL_STRING(class_name, "imagick", 1);
INIT_ZVAL(class_name);
ZVAL_STRING(&class_name, "imagick", 0);

PHALCON_INIT_NVAR(ret);
phalcon_call_func_p1(ret, "class_exists", class_name);

if (!zend_is_true(ret)) {
if (!phalcon_class_exists(&class_name, 0 TSRMLS_CC)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_image_exception_ce, "Imagick is not installed, or the extension is not loaded");
return;
}

phalcon_update_static_property(SL("phalcon\\image\\adapter\\imagick"), SL("_checked"), ret TSRMLS_CC);

ZVAL_BOOL(return_value, 1);

RETVAL_TRUE;
RETURN_MM();
}

Expand Down