mirror of
https://github.com/php/php-src.git
synced 2024-11-28 12:26:37 +08:00
Fix a possible memory leak
This commit is contained in:
parent
dba3fe385d
commit
5ead613386
@ -2740,19 +2740,22 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod
|
||||
{
|
||||
zend_op *opline;
|
||||
int doing_inheritance = 0;
|
||||
zend_class_entry *new_class_entry = emalloc(sizeof(zend_class_entry));
|
||||
char *lcname = zend_str_tolower_dup(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len);
|
||||
zend_class_entry *new_class_entry;
|
||||
char *lcname;
|
||||
|
||||
if (CG(active_class_entry)) {
|
||||
zend_error(E_COMPILE_ERROR, "Class declarations may not be nested");
|
||||
return;
|
||||
}
|
||||
|
||||
lcname = zend_str_tolower_dup(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len);
|
||||
|
||||
if (!(strcmp(lcname, "self") && strcmp(lcname, "parent"))) {
|
||||
efree(lcname);
|
||||
zend_error(E_COMPILE_ERROR, "Cannot use '%s' as class name as it is reserved", class_name->u.constant.value.str.val);
|
||||
}
|
||||
|
||||
new_class_entry = emalloc(sizeof(zend_class_entry));
|
||||
new_class_entry->type = ZEND_USER_CLASS;
|
||||
new_class_entry->name = class_name->u.constant.value.str.val;
|
||||
new_class_entry->name_length = class_name->u.constant.value.str.len;
|
||||
|
Loading…
Reference in New Issue
Block a user