You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2017/10/03 19:34:02 UTC
[1/2] qpid-dispatch git commit: DISPATCH-846: Fix memory leak in
router config.
Repository: qpid-dispatch
Updated Branches:
refs/heads/master a33dd4602 -> e69478a4e
DISPATCH-846: Fix memory leak in router config.
qd_dispatch_set_router_default_distribution() was not freeing its argument.
Also removed some other dispatch.c private configuration functions from
dispatch-private.h and made them static.
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/96cbc159
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/96cbc159
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/96cbc159
Branch: refs/heads/master
Commit: 96cbc159cfe9f7da3a867f759781e69e110e74e5
Parents: a33dd46
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Oct 3 15:16:06 2017 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Oct 3 15:32:46 2017 -0400
----------------------------------------------------------------------
src/dispatch.c | 15 +++++++++++----
src/dispatch_private.h | 12 ------------
2 files changed, 11 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/96cbc159/src/dispatch.c
----------------------------------------------------------------------
diff --git a/src/dispatch.c b/src/dispatch.c
index 760cfdd..511f1e4 100644
--- a/src/dispatch.c
+++ b/src/dispatch.c
@@ -50,10 +50,14 @@ qd_router_t *qd_router(qd_dispatch_t *qd, qd_router_mode_t mode, const char *
void qd_router_setup_late(qd_dispatch_t *qd);
void qd_router_free(qd_router_t *router);
void qd_error_initialize();
+static void qd_dispatch_set_router_id(qd_dispatch_t *qd, char *_id);
+static void qd_dispatch_set_router_area(qd_dispatch_t *qd, char *_area);
+
const char *CLOSEST_DISTRIBUTION = "closest";
const char *MULTICAST_DISTRIBUTION = "multicast";
const char *BALANCED_DISTRIBUTION = "balanced";
const char *UNAVAILABLE_DISTRIBUTION = "unavailable";
+
qd_dispatch_t *qd_dispatch(const char *python_pkgdir)
{
qd_dispatch_t *qd = NEW(qd_dispatch_t);
@@ -148,8 +152,8 @@ qd_error_t qd_dispatch_validate_config(const char *config_path)
return validation_error;
}
-
-void qd_dispatch_set_router_default_distribution(qd_dispatch_t *qd, char *distribution)
+// Takes ownership of distribution string.
+static void qd_dispatch_set_router_default_distribution(qd_dispatch_t *qd, char *distribution)
{
if (distribution) {
if (strcmp(distribution, MULTICAST_DISTRIBUTION) == 0)
@@ -164,6 +168,7 @@ void qd_dispatch_set_router_default_distribution(qd_dispatch_t *qd, char *distri
else
// The default for the router defaultDistribution field is QD_TREATMENT_ANYCAST_BALANCED
qd->default_treatment = QD_TREATMENT_ANYCAST_BALANCED;
+ free(distribution);
}
qd_error_t qd_dispatch_configure_router(qd_dispatch_t *qd, qd_entity_t *entity)
@@ -270,14 +275,16 @@ void qd_dispatch_set_agent(qd_dispatch_t *qd, void *agent) {
qd->agent = agent;
}
-void qd_dispatch_set_router_id(qd_dispatch_t *qd, char *_id) {
+// Takes ownership of _id
+static void qd_dispatch_set_router_id(qd_dispatch_t *qd, char *_id) {
if (qd->router_id) {
free(qd->router_id);
}
qd->router_id = _id;
}
-void qd_dispatch_set_router_area(qd_dispatch_t *qd, char *_area) {
+// Takes ownership of _area
+static void qd_dispatch_set_router_area(qd_dispatch_t *qd, char *_area) {
if (qd->router_area) {
free(qd->router_area);
}
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/96cbc159/src/dispatch_private.h
----------------------------------------------------------------------
diff --git a/src/dispatch_private.h b/src/dispatch_private.h
index 3fc4b9b..7e54ade 100644
--- a/src/dispatch_private.h
+++ b/src/dispatch_private.h
@@ -122,16 +122,4 @@ void qd_dispatch_unregister_entity(qd_dispatch_t *qd, void *impl);
/** Set the agent */
void qd_dispatch_set_agent(qd_dispatch_t *qd, void *agent);
-/**
- * Set a new router id, freeing the prior id string
- * TAKES OWNERSHIP OF THE POINTER PASSED TO IT
- */
-void qd_dispatch_set_router_id(qd_dispatch_t *qd, char *_id);
-
-/**
- * Set a new router area, freeing the prior area string
- * TAKES OWNERSHIP OF THE POINTER PASSED TO IT
- */
-void qd_dispatch_set_router_area(qd_dispatch_t *qd, char *_area);
-
#endif
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/2] qpid-dispatch git commit: DISPATCH-846: Fix leak in
qd_server_connection
Posted by ac...@apache.org.
DISPATCH-846: Fix leak in qd_server_connection
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/e69478a4
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/e69478a4
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/e69478a4
Branch: refs/heads/master
Commit: e69478a4ebfd18f76bfd682329f11e7658a06a59
Parents: 96cbc15
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Oct 3 15:23:33 2017 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Oct 3 15:33:02 2017 -0400
----------------------------------------------------------------------
src/server.c | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e69478a4/src/server.c
----------------------------------------------------------------------
diff --git a/src/server.c b/src/server.c
index 88144a5..5f9a51e 100644
--- a/src/server.c
+++ b/src/server.c
@@ -507,6 +507,7 @@ qd_connection_t *qd_server_connection(qd_server_t *server, qd_server_config_t *c
if (ctx->pn_conn) pn_connection_free(ctx->pn_conn);
if (ctx->deferred_call_lock) sys_mutex_free(ctx->deferred_call_lock);
free(ctx->role);
+ free(ctx);
return NULL;
}
ctx->server = server;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org