Skip to content

Commit

Permalink
Fix possible memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
kocsismate committed Sep 27, 2024
1 parent 5f76e86 commit ffb41ea
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ext/xmlreader/php_xmlreader.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,19 @@ static int xmlreader_has_property(zend_object *object, zend_string *name, int ty
return 0;
}

bool result;

if (type == ZEND_PROPERTY_NOT_EMPTY) {
return zend_is_true(&rv);
result = zend_is_true(&rv);
} else if (type == ZEND_PROPERTY_ISSET) {
result = (Z_TYPE(rv) != IS_NULL);
} else {
ZEND_UNREACHABLE();
}

ZEND_ASSERT(type == ZEND_PROPERTY_ISSET);
return (Z_TYPE(rv) != IS_NULL);
zval_ptr_dtor(&rv);

return result;
}

return zend_std_has_property(object, name, type, cache_slot);
Expand Down

0 comments on commit ffb41ea

Please sign in to comment.