Skip to content

Commit d964863

Browse files
committed
Fixed memory leak in 5.2
1 parent 42a85bd commit d964863

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

yaf_exception.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ void yaf_trigger_error(int type TSRMLS_DC, char *format, ...) {
4545
va_end(args);
4646

4747
if (YAF_G(throw_exception)) {
48+
#if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 3
49+
if (!EG(exception)) {
50+
yaf_throw_exception(type, message TSRMLS_CC);
51+
}
52+
#else
4853
yaf_throw_exception(type, message TSRMLS_CC);
54+
#endif
4955
} else {
5056
yaf_application_t *app = zend_read_static_property(yaf_application_ce, ZEND_STRL(YAF_APPLICATION_PROPERTY_NAME_APP), 1 TSRMLS_CC);
5157
zend_update_property_long(yaf_application_ce, app, ZEND_STRL(YAF_APPLICATION_PROPERTY_NAME_ERRNO), type TSRMLS_CC);
@@ -89,7 +95,7 @@ void yaf_throw_exception(long code, char *message TSRMLS_DC) {
8995

9096
if ((code & YAF_ERR_BASE) == YAF_ERR_BASE
9197
&& yaf_buildin_exceptions[YAF_EXCEPTION_OFFSET(code)]) {
92-
base_exception = yaf_buildin_exceptions[YAF_EXCEPTION_OFFSET(code)];
98+
base_exception = yaf_buildin_exceptions[YAF_EXCEPTION_OFFSET(code)];
9399
}
94100

95101
zend_throw_exception(base_exception, message, code TSRMLS_CC);

0 commit comments

Comments
 (0)