Skip to content

Commit

Permalink
context API: Fix ctx cleanup API; Document context_destroy() behavior
Browse files Browse the repository at this point in the history
Although this patch fixes a memory leak in clear_global_context(), this
function is not being used at all.

(cherry picked from commit 02e1177)
  • Loading branch information
liviuchircu committed Oct 12, 2022
1 parent 6b6551a commit 94b3740
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions context.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ static void register_context_destroy(context_destroy_f f,
count++;
}

/* Note: @ctx will *not* be freed! */
void context_destroy(enum osips_context ctxtype, context_p ctx)
{
int f = 0;
Expand Down Expand Up @@ -146,6 +147,7 @@ void clear_global_context(void)
{
if (current_processing_ctx) {
context_destroy(CONTEXT_GLOBAL, current_processing_ctx);
context_free(current_processing_ctx);
current_processing_ctx = NULL;
}
}
Expand Down
1 change: 1 addition & 0 deletions context.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ void clear_global_context(void);

/*
* destroys a context by calling each callback registered
* Note: @ctx will *not* be freed!
*/
void context_destroy(enum osips_context type, context_p ctx);

Expand Down

0 comments on commit 94b3740

Please sign in to comment.