[sr-dev] [tracker] Comment added: memory leak in mysql module

sip-router bugtracker at sip-router.org
Mon Jun 2 15:22:37 CEST 2014


THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

The following task has a new comment added:

FS#436 - memory leak in mysql module
User who did this - Torrey Searle (tsearle)

----------
I think I have a theory regarding the leak....


in linb/srdb1/db.c

the code is as follows

<code>
    id = new_db_id(url, pooling);
        if (!id) {
                LM_ERR("cannot parse URL '%.*s'\n", url->len, url->s);
                goto err;
        }

    /* Find the connection in the pool */
        con = pool_get(id);
        if (!con) {
                LM_DBG("connection %p not found in pool\n", id);
                /* Not in the pool yet */
                con = new_connection(id);
                if (!con) {
                        LM_ERR("could not add connection to the pool");
                        goto err;
                }
                pool_insert((struct pool_con*)con);
        } else {
                LM_DBG("connection %p found in pool\n", id);
        }

</code>


In the case a new connection is made, the connection will have the reference to the id object you just allocated.

In the case a connection is found from the pool, the connection will have a reference to a previously allocated id object, and the id created by new_db_id should be freed

I suggest that in the case be modified as follows

<code>
    } else {
                LM_DBG("connection %p found in pool\n", id);
                free_db_id(id); // free the new id, as we use the pool instead
                id = 0;
    }


</code>
----------

More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=436#comment1500

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.



More information about the sr-dev mailing list