Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed memory leak in exception handling (#1159) #1174

Merged
merged 2 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions agent/native/ext/lifecycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,10 @@ void elasticApmZendThrowExceptionHookImpl(
resetLastThrown();

#if PHP_MAJOR_VERSION >= 8 /* if PHP version is 8.* and later */
zval thrownAsZval;
zval* thrownAsPzval = &thrownAsZval;
ZVAL_OBJ_COPY( /* dst: */ thrownAsPzval, /* src: */ thrownAsPzobj );
ZVAL_OBJ_COPY(&ELASTICAPM_G( lastException ), thrownAsPzobj );
#else
ZVAL_COPY(&ELASTICAPM_G(lastException), thrownAsPzval );
#endif
ZVAL_COPY( /* pZvalDst: */ &ELASTICAPM_G(lastException), /* pZvalSrc: */ thrownAsPzval );

ELASTIC_APM_LOG_DEBUG_FUNCTION_EXIT();
}
Expand Down Expand Up @@ -577,7 +576,7 @@ void elasticApmRequestShutdown()
ELASTIC_APM_LOG_DEBUG( "opcache.preload request detected on shutdown" );
return;
}

if (ELASTICAPM_G(globals)->periodicTaskExecutor_) {
ELASTIC_APM_LOG_DEBUG("pausing inferred spans thread");
ELASTICAPM_G(globals)->periodicTaskExecutor_->suspendPeriodicTasks();
Expand Down Expand Up @@ -681,4 +680,4 @@ ResultCode elasticApmEnterAgentCode( String dbgCalledFromFile, int dbgCalledFrom

failure:
goto finally;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected function buildCommandLine(array $ports): string
{
Assert::assertCount(1, $ports);
return InfraUtilForTests::buildAppCodePhpCmd($this->agentConfigSourceBuilder->getPhpIniFile())
. " -S localhost:" . $ports[0]
. " -S 0.0.0.0:" . $ports[0]
. ' "' . FileUtilForTests::listToPath([__DIR__, self::APP_CODE_HOST_ROUTER_SCRIPT]) . '"';
}

Expand Down
Loading