[asterisk-commits] pbx: Fix leak of timezone for time based includes. (asterisk[11])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jul 14 12:05:22 CDT 2016
Anonymous Coward #1000019 has submitted this change and it was merged.
Change subject: pbx: Fix leak of timezone for time based includes.
......................................................................
pbx: Fix leak of timezone for time based includes.
Create include_free to run ast_destroy_timing and ast_free, use that in
all places that freed an ast_include structure. This fixes a couple of
paths that previously did not run ast_destroy_timing.
ASTERISK-26196 #close
Change-Id: I1671bd111bef0dc113e8bf8f77f89fcfc395d838
---
M main/pbx.c
1 file changed, 12 insertions(+), 7 deletions(-)
Approvals:
George Joseph: Looks good to me, but someone else must approve
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, approved
diff --git a/main/pbx.c b/main/pbx.c
index 0627ab2..80e1537 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -7119,6 +7119,13 @@
return c;
}
+/*! \brief Free an ast_include and associated data. */
+static void include_free(struct ast_include *include)
+{
+ ast_destroy_timing(&(include->timing));
+ ast_free(include);
+}
+
/*!
* \brief Remove included contexts.
* This function locks contexts list by &conlist, search for the right context
@@ -7166,8 +7173,7 @@
else
con->includes = i->next;
/* free include and return */
- ast_destroy_timing(&(i->timing));
- ast_free(i);
+ include_free(i);
ret = 0;
break;
}
@@ -9595,8 +9601,7 @@
/* ... go to last include and check if context is already included too... */
for (i = con->includes; i; i = i->next) {
if (!strcasecmp(i->name, new_include->name)) {
- ast_destroy_timing(&(new_include->timing));
- ast_free(new_include);
+ include_free(new_include);
ast_unlock_context(con);
errno = EEXIST;
return -1;
@@ -10926,7 +10931,7 @@
for (tmpi = tmp->includes; tmpi; ) { /* Free includes */
struct ast_include *tmpil = tmpi;
tmpi = tmpi->next;
- ast_free(tmpil);
+ include_free(tmpil);
}
for (ipi = tmp->ignorepats; ipi; ) { /* Free ignorepats */
struct ast_ignorepat *ipl = ipi;
@@ -11020,12 +11025,12 @@
if (pi) {
pi->next = i->next;
/* free include */
- ast_free(i);
+ include_free(i);
continue; /* don't change pi */
} else {
tmp->includes = i->next;
/* free include */
- ast_free(i);
+ include_free(i);
continue; /* don't change pi */
}
}
--
To view, visit https://gerrit.asterisk.org/3201
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1671bd111bef0dc113e8bf8f77f89fcfc395d838
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
More information about the asterisk-commits
mailing list