Skip to content

Commit

Permalink
Merge pull request #73 from negram/nullify-vars-prevent-double-frees
Browse files Browse the repository at this point in the history
Nullify references once not used to prevent double-frees
  • Loading branch information
longxinH authored Dec 13, 2022
2 parents 995f857 + 369ebd7 commit 676885b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions extension/xhprof.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ void hp_clean_profiler_state()

if (XHPROF_G(root)) {
zend_string_release(XHPROF_G(root));
XHPROF_G(root) = NULL;
}

/* Delete the array storing ignored function names */
Expand Down Expand Up @@ -1246,6 +1247,7 @@ static void hp_stop()

if (XHPROF_G(root)) {
zend_string_release(XHPROF_G(root));
XHPROF_G(root) = NULL;
}
}

Expand All @@ -1263,6 +1265,7 @@ static inline void hp_array_del(zend_string **names)
int i = 0;
for (; names[i] != NULL && i < XHPROF_MAX_IGNORED_FUNCTIONS; i++) {
zend_string_release(names[i]);
names[i] = NULL;
}

efree(names);
Expand Down

0 comments on commit 676885b

Please sign in to comment.