unbound: Avoid unnecessary cloning of RR list that caused a memory leak
authorTobias Brunner <tobias@strongswan.org>
Tue, 13 Sep 2016 12:12:49 +0000 (14:12 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 20 Sep 2016 13:36:14 +0000 (15:36 +0200)
src/libstrongswan/plugins/unbound/unbound_response.c

index 6f6c25e..950df34 100644 (file)
@@ -189,7 +189,7 @@ unbound_response_t *unbound_response_create_frm_libub_response(
                 */
                rr_list = linked_list_create();
 
-               orig_rr_list = ldns_pkt_get_section_clone(dns_pkt, LDNS_SECTION_ANSWER);
+               orig_rr_list = ldns_pkt_answer(dns_pkt);
                orig_rr_count = ldns_rr_list_rr_count(orig_rr_list);
 
                for (i = 0; i < orig_rr_count; i++)
@@ -253,7 +253,6 @@ unbound_response_t *unbound_response_create_frm_libub_response(
                this->rr_set = rr_set_create(rr_list, rrsig_list);
 
                ldns_pkt_free(dns_pkt);
-               ldns_rr_list_free(orig_rr_list);
        }
        return &this->public;
 }