You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by dskarbek <gi...@git.apache.org> on 2016/11/01 22:10:30 UTC

[GitHub] qpid-dispatch pull request #108: Fix memory leaks

Github user dskarbek commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/108#discussion_r86036444
  
    --- Diff: src/router_core/router_core.c ---
    @@ -106,29 +106,31 @@ void qdr_core_free(qdr_core_t *core)
         sys_mutex_free(core->work_lock);
         sys_mutex_free(core->id_lock);
         qd_timer_free(core->work_timer);
    +
         for (int i = 0; i <= QD_TREATMENT_LINK_BALANCED; ++i) {
             if (core->forwarders[i]) {
                 free(core->forwarders[i]);
             }
         }
    -    if (core->addr_hash) {
    -        qd_hash_free(core->addr_hash);
    -    }
    -    if (core->conn_id_hash) {
    -        qd_hash_free(core->conn_id_hash);
    -    }
    -    if (core->query_lock) {
    -        sys_mutex_free(core->query_lock);
    -    }
    -    if (core->routers_by_mask_bit) {
    -        free(core->routers_by_mask_bit);
    -    }
    -    if (core->control_links_by_mask_bit) {
    -        free(core->control_links_by_mask_bit);
    +
    +    qdr_address_t *addr = 0;
    +    while ( (addr = DEQ_HEAD(core->addrs)) ) {
    +        qdr_core_remove_address(core, addr);
         }
    -    if (core->data_links_by_mask_bit) {
    -        free(core->data_links_by_mask_bit);
    +    qdr_address_config_t *addr_config = 0;
    +    while ( (addr_config = DEQ_HEAD(core->addr_config))) {
    +        free_qdr_address_config_t(addr_config);
    --- End diff --
    
    this is a bug.  I've got an update to the commit that fixes this which I haven't pushed yet.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org