Skip to content

Commit

Permalink
fix: throwing new exception from post hook lead to memory leak (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelewski authored Nov 24, 2022
1 parent 763de42 commit ab6fee6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions otel_observer.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,16 @@ static void observer_end(zend_execute_data *execute_data, zval *retval, zend_lli
}
}
}

if (UNEXPECTED(EG(exception))) {
if (exception) {
OBJ_RELEASE(exception);
}
OBJ_RELEASE(Z_OBJ(params[3]));

ZVAL_OBJ_COPY(&params[3], EG(exception));
}

zend_exception_restore();
EG(prev_exception) = exception;
zend_exception_restore();
Expand Down

0 comments on commit ab6fee6

Please sign in to comment.