]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Fix memory leak in subscription handling
authorTravis Cross <tc@traviscross.com>
Sat, 12 Apr 2014 04:30:19 +0000 (04:30 +0000)
committerTravis Cross <tc@traviscross.com>
Sat, 12 Apr 2014 05:00:41 +0000 (05:00 +0000)
We were leaking one event (~539 bytes) for every subscribe packet
received with both an "event: as-feature-event" and an authorization
header.

src/mod/endpoints/mod_sofia/sofia_presence.c

index 345ed0b1d3df6c9032b01f3c4e7af5c9b8b94873..0bb24b0e112c7fb93ba712fb5cfc2caf54e78c43 100644 (file)
@@ -3735,6 +3735,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
                        auth_res = sofia_reg_parse_auth(profile, authorization, sip, de,
                                                                                        (char *) sip->sip_request->rq_method_name, key, sizeof(key), network_ip, network_port, &v_event, 0,
                                                                                        REG_REGISTER, to_user, NULL, NULL, NULL);
+                       if (v_event) switch_event_destroy(&v_event);
                } else if ( sofia_reg_handle_register(nua, profile, nh, sip, de, REG_REGISTER, key, sizeof(key), &v_event, NULL, NULL, NULL)) {
                        if (v_event) {
                                switch_event_destroy(&v_event);