Skip to content

Commit

Permalink
Merge pull request #92 from scoutapp/further-missed-free-for-determin…
Browse files Browse the repository at this point in the history
…e-function-name-in-php-8

Fixing more missed free calls in PHP 8 only
  • Loading branch information
asgrim authored Jun 29, 2021
2 parents 469acfa + 69a5e5b commit 9d7fee1
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 5 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 1.4.2 - 2021-06-29

### Added

- Nothing.

### Changed

- Nothing.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- [#92](https://github.com/scoutapp/scout-apm-php-ext/pull/92) Fixed some missed free calls after DYNAMIC_MALLOC_SPRINTF usage in PHP 8 only

## 1.4.1 - 2021-06-29

### Added
Expand Down
24 changes: 20 additions & 4 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@

<!-- Current Release -->
<date>2021-06-29</date>
<time>12:00:00</time>
<time>13:00:00</time>
<version>
<release>1.4.1</release>
<api>1.4.1</api>
<release>1.4.2</release>
<api>1.4.2</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="https://opensource.org/licenses/MIT">MIT</license>
<notes>
- Fixed memory leaks from DYNAMIC_MALLOC_SPRINTF un-freed usages (#91)
- Fixed some missed free calls after DYNAMIC_MALLOC_SPRINTF usage in PHP 8 only (#92)
</notes>
<!-- End Current Release -->

Expand Down Expand Up @@ -110,6 +110,22 @@
<zendextsrcrelease />

<changelog>
<release>
<date>2021-06-29</date>
<time>12:00:00</time>
<version>
<release>1.4.1</release>
<api>1.4.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="https://opensource.org/licenses/MIT">MIT</license>
<notes>
- Fixed memory leaks from DYNAMIC_MALLOC_SPRINTF un-freed usages (#91)
</notes>
</release>
<release>
<date>2021-06-17</date>
<time>16:00:00</time>
Expand Down
5 changes: 5 additions & 0 deletions scout_observer.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ static void scout_observer_end(zend_execute_data *execute_data, zval *return_val
record_observed_stack_frame(function_name, SCOUTAPM_G(observer_api_start_time), scoutapm_microtime(), argc, argv);
SCOUTAPM_G(currently_instrumenting) = 0;
SCOUTAPM_G(observer_api_start_time) = 0;

free((void*) function_name);
}

// Note: this is only called FIRST time each function is invoked (better that way)
Expand All @@ -109,9 +111,12 @@ zend_observer_fcall_handlers scout_observer_api_register(zend_execute_data *exec

// Can only resolve magic method name at call-time with Observer API, so pass NULL for the magic method name
if (should_be_instrumented(function_name, NULL) == 0) {
free((void*) function_name);
return handlers;
}

free((void*) function_name);

handlers.begin = scout_observer_begin;
handlers.end = scout_observer_end;
return handlers;
Expand Down
2 changes: 1 addition & 1 deletion zend_scoutapm.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "scout_execute_ex.h"

#define PHP_SCOUTAPM_NAME "scoutapm"
#define PHP_SCOUTAPM_VERSION "1.4.1"
#define PHP_SCOUTAPM_VERSION "1.4.2"

/* Extreme amounts of debugging, set to 1 to enable it and `make clean && make` (tests will fail...) */
#define SCOUT_APM_EXT_DEBUGGING 0
Expand Down

0 comments on commit 9d7fee1

Please sign in to comment.