Bug Fix of double freeing. It used to create a new object for all get commands of class/struct pointers.

Now creating only if newobject is lit, or else creating a basic zend object to return to user.
This commit is contained in:
Nihal 2017-07-02 19:39:39 +05:30
commit 42f012b2d1

View file

@ -1162,7 +1162,9 @@ public:
if (retType_class) {
String *retZend_obj = NewStringEmpty();
Printf(retZend_obj, "%s_object_new(%s_ce)", retType_class, retType_class);
Replaceall(tm, "$zend_obj", retType_valid ? (constructor ? "NULL" : retZend_obj) : "NULL");
String *ret_other_Zend_obj = NewStringEmpty();
Printf(ret_other_Zend_obj, "zend_objects_new(%s_ce)", retType_class);
Replaceall(tm, "$zend_obj", retType_valid ? (constructor ? "NULL" : (newobject ? retZend_obj : ret_other_Zend_obj)) : "NULL");
}
Replaceall(tm, "$newobj", retType_valid ? "1" : "2");
Replaceall(tm, "$c_obj", constructor? "1" : "0");